|
-
Jun 29th, 2000, 05:05 AM
#1
Thread Starter
Junior Member
I'm quite new at vb and was wondering if someone could show me how to make a simple timer. Like have a label say "1" then "2" then "3" and so on.
-
Jun 29th, 2000, 05:43 AM
#2
transcendental analytic
Code:
'in declarations
Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
'in code
Dim t&
t=gettickcount
Do
doevents
label1=int((gettickcount-t)/1000))
loop until YouWantItToStopBooleanValue
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 29th, 2000, 05:51 AM
#3
Here is an example using the Timer function. The DoEvents lets Window's do other tasks so your computer does not freeze.
Code:
Go = Timer
Do Until Timer > Go + 3
DoEvents
' place other code here
MyNum = MyNum + 1
Loop
Print MyNum
-
Jun 29th, 2000, 06:26 AM
#4
Code:
Function timeout(interval)
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Function
'create a timer and set its interval to 100
'in the timer put:
For i = 0 to 10 'count to 10
Label1.caption = i 'count 1 to 10 showing contents on label
Timeout .01 'timeout
Next 'loop until 10
Timer1.enabled = False 'turn timer off after 10
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
|