ตัวอย่างหน้าตาของโปรแกรม
(http://www.mx7.com/i/de0/2sHSoc.png)
ตัวอย่างโค้ด ในส่วนของนาฬิกาจับเวลา (นับขึ้น)
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If S < 59 Then
S = S + 1
Else
S = 0
If N < 59 Then
N = N + 1
Else
N = 0
If M < 9 Then
M = M + 1
Else
Timer1.Enabled = False
End If
End If
End If
Label1.Text = Format(S, "00")
Label2.Text = Format(N, "00")
Label3.Text = Format(M, "00")
End Sub
ฟังก์ชั่นนับเวลาถอยหลังโดยใช้ component timer
Private Sub Timer2_Timer()
value = value - 1
If value = -1 Then
value = 59
value2 = value2 - 1
End If
If value2 = -1 Then
value2 = 59
value3 = value3 - 1
End If
If value3 < 0 Then
Timer2.Enabled = False
value = 0
value2 = 0
value3 = 0
End If
If value3 = 0 And value2 = 0 And value = 0 Then
Timer2.Enabled = False
status = False
Command1.Caption = "เริ่ม"
End If
Label1.Caption = Format(value, "0#")
Label2.Caption = Format(value2, "0#")
Label3.Caption = Format(value3, "0#")
LED1.Number = value
End Sub