sjn78 Posted November 27, 2003 Posted November 27, 2003 I have a small window popup and it runs a process. Takes about 30 seconds. I have a button on it that closes this window. The problem is, I can't get to that button until the process is finished. How can I do this so I can press the 'Cancel' button midway through a function routine that stops the process and closes the form. Quote
Voca Posted November 27, 2003 Posted November 27, 2003 Try using the process-Class Something like: Dim myProcess as Process myProcess = Process.Getbyname("MyProcessname") myprocess.Kill Something like that should do it, but I'm not sure about the correct Names of the function how to obtain the correct process (no VS near:( ) Voca Edit: Reread your question - must admitt I misinterpreted your question at first - I thought you would like to kill the process. This is not the answer to your Question Terribly sorry Quote
Moderators Robby Posted November 27, 2003 Moderators Posted November 27, 2003 If your process is in a loop you can place an Application.DoEvents, this will allow the cancel to be clicked, be careful because all the controls are clickeable during this time so you should disable them until the process completes. There are two ways of handling the above approach... 1) Set a flag before going into the function and check the status of the flag on each iteration. The cancel button would change flag status so the next time it loops you would be able to cancel. 2) Use Threading Quote Visit...Bassic Software
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.