1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to introduce delay in vb 6.0

Discussion in 'Visual Basic ( VB )' started by ndakota, Aug 13, 2007.

  1. ndakota

    ndakota New Member

    Joined:
    Aug 9, 2007
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    as we have delay() function in C/C++ is there any function in Visual Basic?

    Is there any way in which timer event can be used to introduce delay?

    Please help..
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Use the Sleep function
     
  3. ndakota

    ndakota New Member

    Joined:
    Aug 9, 2007
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    Please tell me the syntax and constraints applicable to that function.
    also, please let me know if i can open other applications (like notepad) using any inbuilt function in vb.
    please tell me the syntax also.
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Here is the sample.
    Code:
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    
    Private Sub Command1_Click()
      Debug.Print "Started - " & Time()
      Sleep 1000
      Debug.Print "Ended - " & Time()
    End Sub
    You need to be the Shell / ShellEx API and the sample is
    Code:
    shell("notepad",1)
     

Share This Page