Недавно начал изучать Visual Basic. Решил написать простой таймер. Вот не могу разобраться с кнопкой, а точнее хочу чтоб 1 кнопка выполняла 2 действия (Старт/Стоп). Как это сделать ?
Код :
Option Explicit
Private Sub Form_Load()
Form1.AutoRedraw = True
Form1.BorderStyle = 3
Form1.Caption = "Timer"
Command1.Caption = "Start"
Label1.BorderStyle = 1
Label2.BorderStyle = 1
Label3.BorderStyle = 1
Label1.Caption = "00"
Label2.Caption = "00"
Label3.Caption = "00"
Label1.Alignment = 2
Label2.Alignment = 2
Label3.Alignment = 2
Label1.FontSize = 32
Label2.FontSize = 32
Label3.FontSize = 32
Timer1.Interval = 10
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Label3.Caption = Label3.Caption + 1
If Label3.Caption > 99 Then
Label3.Caption = "0"
Label2.Caption = Label2.Caption + 1
End If
If Label2.Caption > 59 Then
Label2.Caption = "0"
Label1.Caption = Label1.Caption + 1
End If
If Label1.Caption > 59 Then
Label1.Caption = "0"
End If
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
Command1.Caption = "Stop"
End Sub
Заранее благодарен.