yang perlu dingat adalah event ini terjadi saat user ato pengguna menekan tombol keyboard atau yang lebih tepat nya pada event Keypress(KeyAscii as integer). nah untuk mengizinkan user hanya menginput berupa angka (number) codding nya seperti dibawah ini
Option Explicit
Const vbKeyDecPt = 46
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyDecPt Or KeyAscii = vbKeyBack Then Exit Sub Else KeyAscii = 0 End If End Sub
Untuk Menampilkan semua huruf Kapital (Huruf besar) pada textbox walaupun tombol Caps lock pada keyboard tidak di pencet codding seperti dibawah ini
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Event ini tidak akan berjalan kalo codding nya tidak ditempatkan pada event KeyPress(KeyAscii As Integer).
Option Explicit
Const vbKeyDecPt = 46
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyDecPt Or KeyAscii = vbKeyBack Then Exit Sub Else KeyAscii = 0 End If End Sub
Untuk Menampilkan semua huruf Kapital (Huruf besar) pada textbox walaupun tombol Caps lock pada keyboard tidak di pencet codding seperti dibawah ini
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Event ini tidak akan berjalan kalo codding nya tidak ditempatkan pada event KeyPress(KeyAscii As Integer).