Results 1 to 6 of 6

Thread: [RESOLVED] do until event

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    269

    Resolved [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

  2. #2

  3. #3
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: do until event

    You could try something like this using a flag:
    VB Code:
    1. Option Explicit
    2.  
    3. Private MouseMove As Boolean
    4.  
    5. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    6.  
    7.     Do Until MouseMove = True
    8.         '
    9.         '   do whatever, may need to through a DoEvents statement in too
    10.         '
    11.         DoEvents
    12.     Loop
    13.    
    14. End Sub
    15.  
    16. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    17.  
    18.     MouseMove = True
    19.    
    20. End Sub
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    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?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    269

    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

  6. #6
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: do until event

    Quote 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
  •  



Click Here to Expand Forum to Full Width