Results 1 to 3 of 3

Thread: How do I.....

  1. #1

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245

    Post

    I want several instructions to take place in order and all starting from one Command1_Click().

    Example:

    Command1_Click()
    Instruction1
    Instruction2
    Instruction3
    End Sub

    Only when I do this, "Instruction1", "Instruction2", and "Instruction3" are not executing in order, instead they seem to be happening all at once. How should I code this, to make each instruction hapen in exact order?

    P.S. I also used:
    IF a or b or c or d or e or f Then
    Instructions
    End IF

    What would be a more efficient way to write this? Would it be:
    If a to f then
    Instructions
    End If

    Thanks,
    Daniel Christie

  2. #2
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Post

    i have 2 ways for ya one way is to

    dim happy as integer

    Private Sub Form_Load()
    timer1.interval = 65
    End Sub
    private sub command1_Click()
    timer1.enabled = true
    a = 0
    end if

    Private Sub Timer1_Timer()
    a = a + 1
    if a = 20 then
    instrcutions1
    end if
    if a = 40 then
    instructions2
    end if
    if a = 60 then
    instructions3
    timer1.enabled = false
    a = 0
    end if
    End Sub

    the second way is to take out the option explicit and put this in there

    Sub Timeout(duration)
    StartTime = Timer
    Do While Timer - StartTime < duration: DoEvents
    Loop
    End Sub

    Private sub command1_click()
    instructions1
    timeout(10)
    instructions2
    timeout(10)
    instructions3
    end sub

    i don't know how to get that
    Sub Timeout(duration)
    StartTime = Timer
    Do While Timer - StartTime < duration: DoEvents
    Loop
    End Sub
    to work unless you take out the option explicit. Well i hope this helps

    ------------------
    Sincerely,
    Chris
    :-) ;-)
    just have fun out there and live life to the fullest while it is still here
    Email [email protected]


  3. #3

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245

    Post

    Thanks, PITBULLCJR!

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