Translate

Jumat, 10 Januari 2014

Tips-tips dan tric Visual Basic 6.0

Tips dan trik vb 6.0

-->Membuata Hanya Angka saja yang bisa di Input dalam TextBoxt

Private Sub txtNomor_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("0") & Chr(13) _

And KeyAscii <= Asc("9") & Chr(13) _

Or KeyAscii = vbKeyBack _

Or KeyAscii = vbKeyDelete _

Or KeyAscii = vbKeySpace) Then

Beep

KeyAscii = 0

End If

End Sub

-->

-->Membuata Hanya Hurup saja yang bisa di Input dalam TextBoxt

Private Sub txtNama_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= Asc("a") & Chr(13) _

And KeyAscii <= Asc("z") & Chr(13) _

Or (KeyAscii >= Asc("A") & Chr(13) _

And KeyAscii <= Asc("Z") & Chr(13) _

Or KeyAscii = vbKeyBack _

Or KeyAscii = vbKeyDelete _

Or KeyAscii = vbKeySpace)) Then

Beep

KeyAscii = 0

End If

End Sub

--> Membersihkan Seluruh Control TextBox dan Combo Box

Sub Clear()

For Each Control In Me.Controls

If TypeOf Control Is TextBox Then

Control.Text = ""

End If

If TypeOf Control Is ComboBox Then

Control.Text = ""

End If

Next Control

End Sub

Tidak ada komentar:

Posting Komentar