how creat a cancel form / multi task

srdva59

Active member
Joined
Feb 21, 2009
Messages
28
Programming Experience
Beginner
hi,
i have
a function to export data with some loops now the problem is that
when he is exporting the data the program stop responding and only
respond when the job is done, and i need a option to cancel the job
when it is running but the problem simple block all forms that is opened
how can i creat some multi task for fix that problem?
thanks a lot for your help :)
 
search the help for "backgroundworker"

If you want it more simple (and not multithreaded), simply add
Application.DoEvents()
somewhere in your loops.
If there are many loop runs, you shouldn't do this in EACH run of the loop, but for example only if loopcounter mod 10 = 0 (to give some time to the UI), because otherwise your loops will run much longer.
And of course, somewhere in your loop you need to check if the user canceled the job.
 
Don't advise people to DoEvents; get them not to perform their work on the UI thread.
 
Back
Top