terkadang suatu textbox kita menginginkan buat inputnya untuk huruf aja
jadi ini dia codingnya, umm ... sebenarnya bisa sih pake fungsi InStr , hehehe
lebih afdhol pake yang ini deh
preparation :
1 project standar EXE
1 textbox
Public Sub Hurufsaja(ByRef 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
KeyAscii = 0
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Hurufsaja KeyAscii
End Sub
hehehe.. silahkan coba niih :D
0 komentar:
Posting Komentar