|
-
Feb 25th, 2006, 02:50 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] do until event
hi. is there a way to make something stop when an event is raised.
this is my case.
i have a line of code the MouseDown event. i want it to go on a loop until the mousemove entent starts (until the user moves the mouse).
so i have 2 questions:
1) How can i do this?
2) Apart from this case, just to know: Is there a way to make a loop stop when an event raises like "loop until label1_click" or something like that?
Thanks
-
Feb 25th, 2006, 03:48 PM
#2
Re: do until event
here is a thread about loop cancelling: http://www.vbforums.com/showthread.php?t=387163
it should give you an idea
-
Feb 26th, 2006, 01:58 AM
#3
Re: do until event
You could try something like this using a flag:
VB Code:
Option Explicit
Private MouseMove As Boolean
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Do Until MouseMove = True
'
' do whatever, may need to through a DoEvents statement in too
'
DoEvents
Loop
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseMove = True
End Sub
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Feb 26th, 2006, 02:50 AM
#4
Re: do until event
Nice Pnish, I just added MouseMove = False at the beggining of Form_MouseDown event, is this a valid correction for your code?
-
Feb 26th, 2006, 11:20 AM
#5
Thread Starter
Hyperactive Member
Re: do until event
thanks a lot pnish your code will work for sure 
and thanks bushmobile ill read that topic now.
also thanks jcis for the correction
-
Feb 26th, 2006, 03:38 PM
#6
Re: do until event
 Originally Posted by jcis
Nice Pnish, I just added MouseMove = False at the beggining of Form_MouseDown event, is this a valid correction for your code?
Oops, my bad. Definitely a good idea
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
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
|