CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: time

  1. #1
    Guest

    time

    how do i make it so that my form will pause for a small amount of time?
    i have tried the code

    Public Sub Time_Timeout(howlong)
    current = Timer
    Do While Timer - current < Val(howlong)
    DoEvents
    Loop
    End Sub

    but it keeps saying current is not defined. How would I define current to timer? Or, how would I make my form pause for a limited amount of tme?



  2. #2
    Guest

    Re: time

    Try to add this API function to your code : sleep

    sleep (number)
    ( "number" contain laps time you want to wait, in millisecondes)


  3. #3
    Join Date
    Nov 1999
    Location
    California, USA
    Posts
    40

    Re: time

    Ok try this

    make 2 forms, make them identicle with a control array, make the first one with everything locked, and put a timer on it. put in for the code:

    unload me
    form2.show
    under the timers code. then the other form will come up, but remember to unlock the second form. well i hope that works

    PanasonicSubz

  4. #4
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: time

    I have to examples one is with timer second is with API which is more accurate:

    Sub Wait(Seconds)

    Current = Timer
    Do While Timer - Current < Val(Seconds)
    DoEvents
    Loop
    End Sub



    and:

    private Declare Sub Sleep Lib "kernel32" _
    (byval dwMilliseconds as Long)

    Sub Wait(Seconds as Single)

    Dim lMilliSeconds as Long
    lMilliSeconds = Seconds * 1000
    Sleep lMilliSeconds

    End Sub






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

Featured