|
-
December 26th, 2008, 07:36 PM
#16
Re: Splash Form Timer.Tick - not Working
Already tried that. 
They are both the EXACT same!!
I'm going to create a second form for the splashscreen in the same program and see if I can get it working. If I can, then I'll just ditch the one thats 'broken'!
-
December 26th, 2008, 07:43 PM
#17
Re: Splash Form Timer.Tick - not Working
Are you sure that your delegate methods are connected to the events so they are all working ? So simple set a breakpoint into the Tick event delegates first line and look if the program stops there ? If not, the delegate isn't called so it isn't set (Look into the timers Events List in the propertiesForm ( You can also look into the forms designer.cs if the delegate is coupled to the Tick event
 Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
-
December 26th, 2008, 07:45 PM
#18
Re: Splash Form Timer.Tick - not Working
 Originally Posted by JonnyPoet
Are you sure that your delegate methods are connected to the events so they are all working ? So simple set a breakpoint into the Tick event delegates first line and look if the program stops there ? If not, the delegate isn't called so it isn't set (Look into the timers Events List in the propertiesForm ( You can also look into the forms designer.cs if the delegate is coupled to the Tick event 
I think the timer's tick event handler is ok. The event is connected to the handler on form load.
-
December 26th, 2008, 07:50 PM
#19
Re: Splash Form Timer.Tick - not Working
It seems to be coupled ok. I also created a second timer, and copied the code for the tick event into that one, and executed with that timer instead, but no joy. The timer.Tick seems to be ignored......its like it goes through the code executing fine, but ignores any reference to the timer, and then just loads the main form. I tried commenting out the this.opacity = 100 aswell and the main form still shows........are we sure that the code is correct:
Code:
private void timer2_Tick(object sender, EventArgs e)
{
if (timerClock >= 20)
{
SplashForm.Opacity = SplashForm.Opacity - .04;
}
timerClock++;
if (timerClock == 60)
{
SplashForm.Close();
this.Opacity = 100;
timer1.Enabled = false;
}
}
-
December 26th, 2008, 07:50 PM
#20
Re: Splash Form Timer.Tick - not Working
 Originally Posted by marceln
I think the timer's tick event handler is ok. The event is connected to the handler on form load.
But we DONT know that the Form_Load method is actually connected in the DESIGNER file.
Of course, if the OP would just follow the wuggestions, and post results we would be able to determine if THAT method was actually getting fired off....
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 26th, 2008, 07:58 PM
#21
Re: Splash Form Timer.Tick - not Working
 Originally Posted by JonnyPoet
So simple set a breakpoint into the Tick event delegates first line and look if the program stops there ?
All my breakpoints are being ignored. I set them, run in Debug mode, and it doesn't stop.
 Originally Posted by JonnyPoet
(Look into the timers Events List in the propertiesForm
It is set as timer2_Tick in the timer 'Tick' event.
 Originally Posted by JonnyPoet
( You can also look into the forms designer.cs if the delegate is coupled to the Tick event 
How do I do this....MainForm.cs(Design) or MainForm.cs? CPUWizard your rapidly making me afraid to ask questions......
-
December 26th, 2008, 08:07 PM
#22
Re: Splash Form Timer.Tick - not Working
 Originally Posted by funnyusername
All my breakpoints are being ignored. I set them, run in Debug mode, and it doesn't stop.
Breakpoints are never "Ignored".... Either:
1) You are setting them on code which is not part of the project (the red circle will change to a ring when the program is running.
OR
2) The code is never being executed. And "Suprise"...doe that is not executed does not have an effect.
WHERE are you assigning the Load event to MainForm_Load...
The code should look like:
Code:
this.Load += new EventHandler(MainForm_Load);
This code should be in MainForm.Designer.cs.
If it is not, go back (do NOT manually edit the file) and look at the Events tab on the properties for the form, and see what is there for the Load event.....
[ps: If you had just set the breakpoints and reported that thery were not being hit, we could have been at this point an hour and a half ago.....]
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 26th, 2008, 08:12 PM
#23
Re: Splash Form Timer.Tick - not Working
Incidentially, I do appreciate the help, and I apologise if it appears differently.
CPUWizard, with over 11,000 posts, you obviously give a lot of your time to helping others, and I understand that it must be frustrating when people like me come on, who are learning from books instead of experts, and have not done everything in the best possible order. Sorry if my post above seemed ungrateful, but I think we established that I am not as up to speed with the debugger as I obviously should be, and I have been following the steps in each suggestion above as best I can. Thankyou for your help, if you can advise on the problem at hand I would be grateful, and I WILL try to learn more about the debugger. But right now the debugger is the least of my worries! Thanks.
I created a brand new shiny empty project. Created a second form, used the code from my 'broken' project, and everything worked fine.
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace NewAttempt
{
public partial class Form1 : Form
{
SplashFrm SplashForm = new SplashFrm();
int timerClock = 0;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SplashForm.Show();
this.Opacity = 0;
timer1.Interval = 100;
timer1.Enabled = true;
timer1.Tick += new System.EventHandler(this.timer1_Tick);
}
private void timer1_Tick(object sender, EventArgs e)
{
if (timerClock >= 20)
{
SplashForm.Opacity = SplashForm.Opacity - .04;
}
timerClock++;
if (timerClock == 60)
{
SplashForm.Close();
this.Opacity = 100;
timer1.Enabled = false;
}
}
}
}
This makes no sense?
-
December 26th, 2008, 08:17 PM
#24
Re: Splash Form Timer.Tick - not Working
 Originally Posted by funnyusername
....I understand that it must be frustrating when people like me come on, who are learning from books instead of experts ...
Not at all...People who are learning for a good book, and following it carefully are the best. I DO get fustrated (and that is being nice) with people who think they can learn from random samples picked up over the internet.
Zip up yourt project (not the bin or obj directories) and post it. I will pin down what you are missing, then help YOU walk through finding the problem....
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 26th, 2008, 08:20 PM
#25
Re: Splash Form Timer.Tick - not Working
Ok, just saw your reply. Im Program.cs I have:
Code:
namespace New_Program
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
The MainForm properties Load event shows: <i>MainForm_Load</i>
In MainForm.Designer.cs I can't see that line, it doesn't seem to be there.
-
December 26th, 2008, 08:23 PM
#26
Re: Splash Form Timer.Tick - not Working
 Originally Posted by TheCPUWizard
Zip up yourt project (not the bin or obj directories) and post it. I will pin down what you are missing, then help YOU walk through finding the problem....
I can't post it, even though its at a very early stage. Perhaps I can e-mail it to you and simply trust you not to share it? I'll pm you my email address. If you can pin it down I would appreciate the walk through. Thankyou.
Its very upsetting.....I can't understand why the same code works fine in two other projects.....
-
December 26th, 2008, 09:21 PM
#27
Re: Splash Form Timer.Tick - not Working
Hello all,
Well the noobie is very embarassed! The issues seems to have been a corrupt build environment, and a rebuild fixed it! I guess running a rebuild is one of those basic things which I've just learned, and won't forget in a hurry. Thankyou all for helping, and especially TheCPUWizard who offered his email and time, and then identified this immediately. Cheers CPUWizard (I make a practise not to use peoples real names on the internet without permission, so please don't take offence).
Well, I'm off to learn some more through trial and error. Can anyone suggest a good C# book on amazon, that has a decent amount of info on debugging?
Thanks again. 
L8rs.
-
December 26th, 2008, 09:24 PM
#28
Re: [RESOLVED] Splash Form Timer.Tick - not Working
PS: I dont know how to rate people for helping, so I guess a thankyou will have to do. THANKYOU ALL, I appreciate it.
-
December 26th, 2008, 09:27 PM
#29
Re: [RESOLVED] Splash Form Timer.Tick - not Working
 Originally Posted by funnyusername
PS: I dont know how to rate people for helping, so I guess a thankyou will have to do. THANKYOU ALL, I appreciate it. 
it's the "ballance" icon in the upper-right corner of every post.
-
December 26th, 2008, 09:42 PM
#30
Re: Splash Form Timer.Tick - not Working
Last edited by TheCPUWizard; December 26th, 2008 at 09:49 PM.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|