C# background worker and timer loop
- by Mike
This is my first attempt of a Timer, if someone could help me out where I am going wrong it would be awesome.
I'm trying to use a while loop where if the timer hits 30 seconds try to loop it again.
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
System.Windows.Forms.Timer my_timer = new System.Windows.Forms.Timer();
my_timer = null;
//int restartticker = 30000;
while (true)
{
my_timer.Start();
if (my_timer.Equals(30000))
{
watcherprocess1();
}
my_timer = null;
}
}
Object reference not set to an instance of an object. my_timer.Start();