Siapkan Component MaskedBox dengan memilih menu project > component >pilih Microsoft Masked Edit Control 6.0
pada Form1 buat 1 textboxt, 2 MaskedBox dan 3 label serta 1 command button [Lihat Gambar dibawah]
Pada properties
=======================
textbox kode
-----------------------
name=txtkode
Mask=99-99
=======================
textbox nama
-----------------------
name=txtnama
Maxlength=25
=======================
textbox tanggal
-----------------------
name=txttanggal
Mask=99-99-9999
=======================
Command button Bersih
-----------------------
name=cmdbersih
=======================
Setelah Setting pada Properties doubleklik pada form isikan listing dibawah ini:
*****************************
Private Sub cmdbersih_Click()
txtkode.Text = "__-__"
txtnama.Text = ""
txttanggal.Text = "__-__-____"
txtkode.SetFocus
End Sub
Private Sub txtkode_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnama.SetFocus
End If
End Sub
Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttanggal.SetFocus
End If
End Sub
Private Sub txttanggal_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdbersih.SetFocus
End If
End Sub
*****************************
Selamat mencoba !!!!
Klik Disini [Download Project]
By: Fajar Jatmika




Tidak ada komentar:
Posting Komentar