While loop not working :S
Hey there
so i made this code, and i do not get why my while loop doesn't work, it checks once and then it continues to the next line, this is my code:
private void Timer1_Tick(object sender, EventArgs e)
{
timer++;
if (timer != 65)
{
timerdone = false;
}
else
{
timerdone = true;
Timer1.Stop();
}
}
private void Report_DoWork(object sender, DoWorkEventArgs e)
{
while (timerdone == true)
{
MessageBox.Show("TEST");
}
}
any idea of whats wrong :S?
Jazerix
Junior Poster in Training
84 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
Well first of all, my code does start the timer :P
secondly, "Report_DoWork", is a backgroundworker that i use for this
I want my application to show the message test once it gets to 65
Jazerix
Junior Poster in Training
84 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
See thats what i dont get, ive been working with "while" before and it have always worked :S
As far as i know, its supposed to loop it becomes valid
Jazerix
Junior Poster in Training
84 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
You know what, i think im getting it now, ill report back in a moment and tell you if it worked :)
Jazerix
Junior Poster in Training
84 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
Got it working now :D
private void Report_DoWork(object sender, DoWorkEventArgs e)
{
while (timerdone != true)
{
Status.Text = "Waiting for timer! " + timer.ToString() + "/65 Left";
}
MessageBox.Show("DONE");
}
Looks awesome! Love you guys thanks for the help :)
Jazerix
Junior Poster in Training
84 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0