Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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

  • Moderators
Posted

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

Visit...Bassic Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...