Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save facebookegypt/1e764aa6e7fc1102cdec0817c7d86648 to your computer and use it in GitHub Desktop.
Save facebookegypt/1e764aa6e7fc1102cdec0817c7d86648 to your computer and use it in GitHub Desktop.
VB6 Project source code example about How to Create Visual Basic 0.6 count-down timer OCX file.
'You may find more detailed description in the link (evry1falls.freevar.com/VB6/count-down-timer.html) for the Visual Basic 0.6 Project
'Create new Visual Basic Desktop Project
'On the Form [Form1] :
'1) Timer control [Name:Timer1]
'2) CommandButton control [Name:Command1, Caption:GO!]
'3) Label control [Name:Label1]
'4) Label control [Name:Label2]
'5) Textbox control [Name:Text1]
'6) CommandButton control [Name:Command2]
'--------Don't forget to always save your VB6 Project after each step.........
Option Explicit
Dim Sec As Integer
Sub Reset()
Sec = 0
Timer1.Enabled = False
Label1.Caption = 0
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then Exit Sub
If Not IsNumeric(Text1.Text) Then Exit Sub
Sec = Text1.Text
Timer1.Enabled = True
Label1.Caption = Sec
End Sub
Private Sub Command2_Click()
Reset
End Sub
Private Sub Form_Load()
Sec = 0
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Sec = Sec - 1
If Sec = 0 Then
Reset
End If
Label1.Caption = Sec
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment