Tuesday, April 15, 2014
Browse Manual »
Wiring »
down
»
shut
»
timer
»
trik
»
vb
»
Trik VB Timer Shut Down
Trik VB Timer Shut Down
Trik VB Timer Shut Down - Trik VB kali ini adalah membuat Timer untuk Shut Down. Postingan ini juga untuk melengkapi tugas pemrograman visual basic di kampusku. Berikut langkah-langkah membuat Timer Shut Down:
Buat dahulu :
3 Label =========== Ganti (name) jadi "ltime", "Label1", "Label2"
1 TextBox ============ Ganti (name) jadi "txttime"
2 Command Button ============ Ganti (name) jadi "cmdok" dan "cmdbatal"
1 Timer ============== Ganti (name) jadi "Timer1"
Copy langsung source kode di bawah ini (double klik pada form)
Private Sub cmdbatal_Click()
txttime.Enabled = True
txttime.Text = ""
txttime.SetFocus
End Sub
Private Sub cmdclose_Click()
End
End Sub
Private Sub cmdok_Click()
txttime.Enabled = False
Call isi_pasword
cmdok.Enabled = False
Form2.Show
Unload Me
End Sub
Private Sub Form_Activate()
Call teks_blok(txttime)
End Sub
Public Sub teks_blok(Teks As Control)
Teks.SetFocus
Teks.SelStart = 0
Teks.SelLength = Len(Teks.Text)
End Sub
Private Sub Form_Load()
cmdok.Enabled = False
cmdbatal.Enabled = True
End Sub
Private Sub smdmin_Click()
Form1.WindowState = 1
End Sub
Private Sub Timer1_Timer()
ltime.Caption = Format(Time, "hh:mm")
End Sub
Private Sub txttime_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If (Mid(txttime, 3, 1) <> ":") Or (Mid(txttime, 1, 1) = ":") Or (Mid(txttime, 2, 1) = ":") Or (Mid(txttime, 4, 1) = ":") Or (Mid(txttime, 5, 1) = ":") Then
MsgBox "Maaf Format Waktu Anda Tidak Sesuai!", vbCritical, "Peringatan"
txttime.Text = ""
txttime.SetFocus
Else
cmdok.Enabled = True
cmdok.SetFocus
End If
End If
If Not (KeyAscii >= (Asc("0")) And KeyAscii <= (Asc("9"))) And ((KeyAscii <> vbKeyBack) Xor (KeyAscii = Asc(":"))) Then KeyAscii = 0
End Sub
Public Sub isi_pasword()
user = InputBox("Isikan Kata Pengaman Anda Untuk Mengunci Program Ini!", "Security")
End Sub
Semoga Berhasil!!!!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment