|
-
Feb 13th, 2009, 12:19 AM
#1
Thread Starter
Addicted Member
Responding other events while executing a long routine
Hai,
I am writing a routine which will take much time,i have written this routine in a module and calling from command button's click event.But while executing that rotine if the user clinks another button i have to stop this routine. Pls help me to achieve this.
Thank you.
-
Feb 13th, 2009, 04:24 AM
#2
Re: Responding other events while executing a long routine
Try adding DoEvent within that sub, or in a loop especially.
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.

-
Feb 13th, 2009, 09:38 AM
#3
Re: Responding other events while executing a long routine
In order for DoEvents to be meaningful at all it must be put in a loop structure because it's only called at that instant. DoEvents is only relevant to your program not your OS. DoEvents can slow things down but in many instances it's a must have.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Feb 13th, 2009, 10:34 AM
#4
Re: Responding other events while executing a long routine
When using DoEvents make sure that you disable the loop in question from being called again whilst it is still running. Example...
Code:
Private Sub Command1_Click()
Command1.Enabled = False
'The big loop with Doevents
Command1.Enabled = True
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|