Rabu, 29 April 2015

Numerik karakter yang bisa diinput di textbox

ini adalah trik vb6 untuk mencegah user input karakter selain numeric di textbox, kecuali enter,backspace dan escape.
tombol pengecualian diatas biasanya dipakai untuk event di object tersebut.
source codenya di tulis di event keypress,

Private Sub TxtKomisi_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 And KeyAscii <> 13 And KeyAscii <> 27 Then KeyAscii = 0

If KeyAscii = 27 Then Unload Me
If KeyAscii = 13 Then
   TxtDT(0).SetFocus
End If

End Sub

Tidak ada komentar:

Posting Komentar