Form Not Responding

Shims

Active member
Joined
Jun 15, 2003
Messages
39
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???
 
Putting the code in a module wouldnt prevent it freezing the UI. Your best bet would be to look into either threading or Async processing.
 
Last edited by a moderator:
The best choice will be multithreading... so you can run the process in a secondary thread, instead of running on the main thread...
 
ok but can you gimme some example code on how to multithread then? I dont know how to do this. thanks!!
 
This will do it.
Code:
Dim newthread As New System.Threading.Thread(AddressOf yoursubname)
You have to make a sub that will be ran in that thread.
 
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...
 
Back
Top