Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A Question About Threading...

Status
Not open for further replies.

jmofthenorth

Technical User
May 8, 2007
7
US
Hi,

I'm relatively new to programming and I have a pretty basic question that needs answering. I have a windows form that has two buttons. When the user presses one button code executes in a long while loop. I would like to allow the user to exit the while loop by pressing the other button, however as I have it set up now, the code executing on the event of the first button press (aka the while loop) prevents the user from selecting the other button. Do I need to use threading to do that? Any help would be greatly appreciated.

Jesse
 
Yes you need to set up a thread. You can use the background worker, but my preference is using System.Threading.
Its farely simple to setup just make sure your function calls are thread safe, i.e. using BeginInvoke() and setting up delegate methods.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top