¨
Buat project baru dengan cara File-> New
Project
¨
Beri nama project sesuka anda
¨
Buat rancangan form seperti gambar di bawah ini;
Tabel Object Property
¨
Buat deklarasi variable
Dim Mldt, Dt, Mn, Hr As Integer
¨ Double
klik pada timer1, ketikkan kode program berikut
'DATE
LbDate.Text = Format(Now, "dddd, dd MMMM yyyy")
'DATE
LbDate.Text = Format(Now, "dddd, dd MMMM yyyy")
LbDayName.Text = "Day Name"
& Format(Now, "dddd")
LbMountName.Text = "MountNAme : "
& Format(Now, "MMMM")
LbDay.Text = "Day : " &
Format(Now, "dd")
LbWeak.Text = "Weekday : "
& Weekday(Now)
'TIME
LbTime.Text = Now
LbJam.Text = Format(Now, "HH : mm :
ss")
LbHour.Text = "Hour : "
& Hour(Now)
LbMinute.Text = "Minute : "
& Minute(Now)
LbSecond.Text = "Second : "
& Second(Now)
¨ Double
klik pada timer1, ketikkan kode program berikut
If Mldt = 10 Then 'detik
If Mldt = 10 Then 'detik
Dt = Dt + 1
Mldt = 0
End If
If Dt = 60 Then 'menit
Mn = Mn + 1
Dt = 0
End If
If Mn = 60 Then 'jam
Hr = Hr + 1
Mn = 0
End If
LbStopWatch.Text = Hr & " : "
& Mn & " : " & Dt
& " : " & Mldt 'menampilkan waktu
Mldt
= Mldt + 1 'MiliDetik
¨ Double
klik pada tombol Start, ketikkan kode program berikut
Mldt = 0
Mldt = 0
Dt = 0
Mn =
0
Hr =
0
Timer2.Enabled = True
¨ Double
klik pada tombol Stop, ketikkan kode program berikut
Timer2.Enabled = False
Timer2.Enabled = False
Tekan tombol F5/Run untuk melihat hasil programnya
Download : Source code Program
Download : e-book Visual basic 2010
Tidak ada komentar:
Posting Komentar