|
-
Oct 9th, 2000, 04:23 AM
#1
Thread Starter
New Member
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?
-
Oct 9th, 2000, 05:06 AM
#2
Addicted Member
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
-
Oct 9th, 2000, 05:14 AM
#3
Junior Member
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.
-
Oct 9th, 2000, 05:15 AM
#4
Thread Starter
New Member
That code gives me a compile error!
That code gives me a compile error!
-
Oct 9th, 2000, 05:20 AM
#5
Thread Starter
New Member
says i can only put comments after end sub and crap like that
-
Oct 9th, 2000, 05:26 AM
#6
Frenzied Member
Have a look at the Timer function example in the VB5 help files.
-
Oct 9th, 2000, 05:54 AM
#7
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|