|
-
August 16th, 2001, 02:55 AM
#1
doevents
i made a funtcio that conatains in the WHILE the DOEVENTS
but when i need to write in my CANCEL BUTTON?
-
August 16th, 2001, 04:09 AM
#2
Re: doevents
You will need to add a boolean to you WHILE loop.
Do While (X > 10) And Not(blnCancelPressed)
' some code
DoEvents
Loop
The (X > 10) must be replaced by your condition. Then when the cancel button is pressed, set the blnCancelPressed to true, so you will exit the loop. Then after the loop, check if they pressed cancel, and exit. This must only be done if further processing comes after the loop. Make sure that blnCancelPressed is accessible from the two functions, so add it to the general declaration section of the module/form.
' Cancel Button
private Sub cmdCancel_Click()
blnCancelPressed = true
End Sub
private Sub SomeSub()
blnCancelPressed = false
Do While (X > 10) And Not(blnCancelPressed)
' some code
DoEvents
Loop
If blnCancelPressed then Exit Sub
' Some Other Processing
End Sub
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
August 16th, 2001, 01:04 PM
#3
Re: doevents
ok 10X, and whats about FOR ....but i want the button to cancel the for and not "end for"
-
August 16th, 2001, 01:40 PM
#4
Re: doevents
Could you please show me your code concerning your question, and tell me exactly what you are trying to do
Thanks
Hisham
Thank You, Hisham
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
|