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'! :(
Printable View
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'! :(
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 :wave:
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;
}
}
All my breakpoints are being ignored. I set them, run in Debug mode, and it doesn't stop.
It is set as timer2_Tick in the timer 'Tick' event.
How do I do this....MainForm.cs(Design) or MainForm.cs? :eek: CPUWizard your rapidly making me afraid to ask questions...... :(
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:
This code should be in MainForm.Designer.cs.Code:this.Load += new EventHandler(MainForm_Load);
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.....]
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.
This makes no sense?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;
}
}
}
}
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....
Ok, just saw your reply. Im Program.cs I have:
The MainForm properties Load event shows: <i>MainForm_Load</i>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());
}
}
}
In MainForm.Designer.cs I can't see that line, it doesn't seem to be there.
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..... :(
Hello all,
Well the noobie is very embarassed! :o 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.
PS: I dont know how to rate people for helping, so I guess a thankyou will have to do. THANKYOU ALL, I appreciate it. :)