Thursday, October 06, 2005

BELAJAR VISUAL BASIC

1. BELAJAR MENGGUNAKAN WAKTU

















Dim AWAL, AKHIR, LAMA As Single
Private Sub Command1_Click()
If Command1.Caption = "START" Then
AWAL = Now
Text1.Text = Format(AWAL, "HH:MM:SS")
Command1.Caption = "STOP"

ElseIf Command1.Caption = "STOP" Then
AKHIR = Now
Text2.Text = Format(AKHIR, "HH:MM:SS")
LAMA = AKHIR - AWAL
Text3.Text = Format(LAMA, "HH:MM:SS")
Command1.Caption = "END"

ElseIf Command1.Caption = "END" Then
End
End If
End Sub

Private Sub Timer1_Timer()
If Command1.Caption = "STOP" Then
Text2.Text = Format(Now, "HH:MM:SS")
Text3.Text = Format(Now - AWAL, "HH:MM:SS")
End If

End Sub

Warning : perhatikan properties timer1 dengan interval sama dengan 1
2. Belajar pencetakan
















Private Sub Command1_Click()
Dim A, B
A = 20: B = 35
Print A + B
Print A - B
Print A * B
Print A / B
End Sub

Private Sub Command2_Click()
End
End Sub

0 Comments:

Post a Comment

<< Home