QUOTE(cbr4rusty @ 18 Apr, 2008 - 10:37 PM)

well I tried adding both of the suggested codes but it was a no go...For the following code I have a richtextbox that I am using to test my timer. I droped the "Timer" from the toolbox onto my form. Is there any way I can get this to repeat without using a loop of somesort?? I'm sure that is what the interval part is for...but I can't seem to get it right.
csharp
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Enabled = true;
timer1.Interval = 2000;
bool Tester = true;
if (Tester == true)
{
richTextBox1.Text = "true";
Tester = false;
}
else
{
richTextBox1.Text = "false";
Tester = true;
}
}
The code should switch richtextbox1 from "true" to "false" every 2 seconds....What am I doing wrong? Should it be under the even Tick?? Thanks!
-Rusty
You are setting the boolean variable Tester to true every time the timer event fires.
Why do you expect Tester to ever test false?
To do what you want you need to move the declaration of Tester outside
the timer event method.
You are redundantly enabling the timer every time the event happens.
It couldn't have happened if the timer wasn't already running!
Jeff