Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Posts
    3

    Red face Unanswered: How to set time in visual basic ?

    Stupid question : (i'm a newbie )

    You got this :


    Begin sub

    MsgBox "Hello"
    ??????????
    MsgBox "Goodbye"

    End Sub

    What must be in place of ??????? to make a pause of 2 seconds ?

    Thanks ...

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Private Declare Sub sapiSleep Lib "kernel32" Alias "Sleep" _
    (ByVal dwMilliseconds As Long)

    Sub sSleep(lngMilliSec As Long)
      If lngMilliSec > 0 Then
        Call sapiSleep(lngMilliSec)
      End If
    End Sub


    Sub Snore(anyTime)
       Call sSleep(anyTime)
       MsgBox "I have slept and snored for " & cTIME & " Milliseconds."
    End Sub


    in your program type
    msgbox("Hello")
        call Snore (2000) ' in MilliSeconds
    msgbox("still awake")

  3. #3
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    With the MsgBox "Hello", because you are going into a messagebox, it will wait there until you respond to the messagebox.

    If you opened a form that looked like a messagebox, then you could use the form's timer facility to do what you want.
    Ken

    Maverick Software Design

    (847) 864-3600 x2

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    It is better not to do that with the MsgBox

    Try this
    Text1 = "Hello"
       Call Snore(2000) ' In MilliSeconds
    Text1 = "Waked up again"

    Where Text1 is a text box on your Form

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •