I have a form with several components. After I selected options from couple of listboxes i then click on a button to perform an infinite loop. my problem is that while the application still running, i want to make a new choice of my option, and then hit the run button again. but since im application is in a loop it doesn't response spontaneously to my action on the form.
What is a good way to solve this kind of problem

regain control
Asim Ahmed
However, as the other guys said a backgroundworker object has all the thread stuff built in so you don't have to worry much about it, or simply create a thread of your own.
Karl Diethrick
Also you may want to consider how often you need to draw whatever it is you are drawing. And only do it so many times per second etc. I wouldn't just be drawing it as fast as your computer can handle. Make it do it X amount of times a second by using a Sleep on that thread or a timer or something. (I'm not sure what you are doing, I'd have to think about the best way)
Vlince
you have to consider BackgroudnWorker component in order to execute task in child thread and keep main thread responsive.
When you execute new query you cancel old one and execute new
hope this helps
Aaron77
still_the_same
Landarzar