I've got a Windows Forms Application that does some data fetching from various places. Because of this I've made a thread that fetches and updates the graphical stuff (progressbar, textfields++).
But I'm having some problems quitting it, the thread that is. It goes something like this:
Thread t = new Thread(new ThreadStart(this.Loop))
t.Start();
and the Loop function
void Loop
{
while(true)
{
if( parent window isDisposed )
break;
/*
fetch and update stuff goes in here...
*/
Thread.Sleep(5000);
}
}
Closing the window will make the while break, but it is now disposed??