I have an Windows Form Application, and in it there is a Button. If you click it, then a big loop with massive work is started which might take some time (up to some minutes). In that time, the Window does not react to anything, you cant even move it. Whats the way to go here? Is there a window Update function i could call? Do i have to run the loop in a new thread?
Share
Use multithreading – here is an example I wrote a while back. You basically do all your processing on another thread so it does not tie up the GUI thread.
http://wraithnath.blogspot.com/2010/09/simple-multi-threading-example.html
Start a new Thread on your button click (if you declare the processing thread as a member you can then stop it etc if you want to cancel the process, you can also have a IsProcessing member variable which is checked in the processing loop)
Have a method for the processing