Results 1 to 7 of 7

Thread: i need a simple pause feature, help?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    3
    I need a simple pause feature! I keep seeing something about declaring files but i have no idea what that is. Is there a simple code for a 1 minute delay? Cant figure out how to use that damn timer thing either! 3rd day with vb5 but cant figure out a simple pause feature. Can u help?

  2. #2
    Addicted Member LAURENS's Avatar
    Join Date
    Jan 2000
    Location
    Utrecht, the Netherlands
    Posts
    138
    Put this in a module.

    Code:
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    
    Public Function Pause(dblSec As Long)
    ' Pause for x seconds
    
       Sleep dblSec * 1000
    
    End Function
    Usage:

    Call Pause(60) 'Wait 1 minute
    Regards,
    Laurens

    Using VB5 Enterprise edition SP3
    VB6 Enterprise edition SP5

  3. #3
    Junior Member
    Join Date
    Aug 2000
    Location
    Rockford, IL
    Posts
    21
    Originally posted by LAURENS
    Put this in a module.

    Code:
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    
    Public Function Pause(dblSec As Long)
    ' Pause for x seconds
    
       Sleep dblSec * 1000
    
    End Function
    Usage:

    Call Pause(60) 'Wait 1 minute

    Hold on LAURENS...
    The person said they have only been using VB for 5 days. I don't know if can even understand a fucntion.

    If you're new...then try figuring out the Timer.

    Its easy to use...
    You have to change Interval on the properties and put you're code in the timer to get it to work.

    I hope its not to confusing...
    VB is really easy to understand.
    Try getting a book like VB in 21 days or VB in 24 hours or something of that sense. Those books are made for beginers.

    Start with the common controls then get into functions and move on to API.

    Thats the way to go!
    I've only been doing it for 3 years...I can remember when I had a tough time.


  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    3

    That code gives me a compile error!

    That code gives me a compile error!

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    3
    says i can only put comments after end sub and crap like that

  6. #6
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Have a look at the Timer function example in the VB5 help files.

    Mark
    -------------------

  7. #7
    New Member
    Join Date
    Oct 2000
    Posts
    9
    To avoid the api's , use the following

    Public Sub Sleep(lngTime As Long)
    'lngTime is the number of seconds to wait
    Dim lngTimeNow As Long ' The Time Now
    lngTimeNow = Timer

    Do Until Int(Timer) - Int(lngTimeNow) = lngTime
    'Loop Until The Time Elapsed = the Pause Requested
    DoEvents
    Loop

    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