Shims Posted June 16, 2003 Posted June 16, 2003 I am processing a lot of information that take up to 10 mins during one button click. For the time that it is processing this info, the program cannot be touched without freezing until the process is over. I would like for this not to happen and possibly put a cancel button somewhere to stop the operation if needed. Maybe i need to run the code in a module??? Quote Stress is directly associated with programming. But if I keep moving on to new stresses, then I am doing my job correctly!
Administrators PlausiblyDamp Posted June 16, 2003 Administrators Posted June 16, 2003 (edited) Putting the code in a module wouldn't prevent it freezing the UI. Your best bet would be to look into either threading or Async processing. Edited June 17, 2003 by PlausiblyDamp Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Shims Posted June 16, 2003 Author Posted June 16, 2003 elaborate? Quote Stress is directly associated with programming. But if I keep moving on to new stresses, then I am doing my job correctly!
*Experts* mutant Posted June 16, 2003 *Experts* Posted June 16, 2003 Use Application.DoEvents(). Quote
iebidan Posted June 16, 2003 Posted June 16, 2003 The best choice will be multithreading... so you can run the process in a secondary thread, instead of running on the main thread... Quote Fat kids are harder to kidnap
Shims Posted June 16, 2003 Author Posted June 16, 2003 ok but can you gimme some example code on how to multithread then? I dont know how to do this. thanks!! Quote Stress is directly associated with programming. But if I keep moving on to new stresses, then I am doing my job correctly!
*Experts* mutant Posted June 16, 2003 *Experts* Posted June 16, 2003 This will do it. Dim newthread As New System.Threading.Thread(AddressOf yoursubname) You have to make a sub that will be ran in that thread. Quote
Shims Posted June 17, 2003 Author Posted June 17, 2003 I tried this and it can withstand a few mouse clicks more before it freeze, but it still does freeze. I want to at least be able to use iexplore without the form going unresponsive... Quote Stress is directly associated with programming. But if I keep moving on to new stresses, then I am doing my job correctly!
*Experts* mutant Posted June 17, 2003 *Experts* Posted June 17, 2003 Thats why I suggested putting Application.DoEvents() in your loop. :) Try it, it should be better than another thread. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.