how can i make a countdown of -30 to be displayed in a label?
Printable View
how can i make a countdown of -30 to be displayed in a label?
VB Code:
Private Sub Form_Load() Timer1.Interval = 1000 '1 sec Label1.Caption = 30 End Sub Private Sub Timer1_Timer() Label1.Caption = Val(Label1.Caption - 1) End Sub
Add a timer to your form and a label. Then use this code:
VB Code:
Public Count As Integer Count = 30 'Add this to your timer: If Count > 0 then Count = Count -1 Label1.Caption = Count end if
This would create a countdown from 30 to 0
By setting the Timer's Interval you can set the speed.
thanx!
Just to slow again ! Oh wel, doesn't matter. Peet's solution works better :)