Results 1 to 4 of 4

Thread: Newbie Question

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    39

    Newbie Question

    Hey,

    I am making a program that has a continuous loop, all up the "cycle" takes around 30 seconds, even after I close the program the loop continues to run (seeing as it includes a mouse_event it is quite annoying).

    I was wondering how I could add a "Stop" button, that kills all processes the program is running but keeps it open?

    Thanks.

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Newbie Question

    Quote Originally Posted by Refl3ct
    Hey,

    I am making a program that has a continuous loop, all up the "cycle" takes around 30 seconds, even after I close the program the loop continues to run (seeing as it includes a mouse_event it is quite annoying).

    I was wondering how I could add a "Stop" button, that kills all processes the program is running but keeps it open?

    Thanks.

    What you need to do is have a varible, like stop (boolen) and then you loop should be like

    VB Code:
    1. do until stop = true
    2. 'loop stuff
    3.  
    4. loop

    all you have to do is set stop to true when you exit the program

  3. #3
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Pakistan
    Posts
    436

    Re: Newbie Question

    declare LoopValue variable below the option explicit
    On form load event write keyprivew = true
    write a procedure in keydown event of form
    VB Code:
    1. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    2.     If KeyCode = vbKeyF10 Then
    3.         LoopValue = 30
    4.      endif
    5. End Sub
    now call this routine within the loop

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    39

    Re: Newbie Question

    That doesn't stop it mid-loop. As I said it's a kind of long loop, and I want to be able to stop mid-way through it. (Instantly).

    Edit - reading above post.

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