coba pake fungsi IsNumeric() bawaan vb nya even nya di change. klo result isnumeric nya false, sendkeys backspace aja
--- In [email protected], H SS <[EMAIL PROTECTED]> wrote: > > Saya Coba Bantu ya..... > > Coba gunakan coding ini: > > Private Sub Text1_KeyPress(KeyAscii As Integer) > Select Case KeyAscii > Case Asc(0) To Asc(9), Asc(vbBack), 13 > Case Else: > MsgBox "Input harus berupa angka", vbOKOnly, "Warning" > KeyAscii = 0 > Text1.Text = "" > End Select > If KeyAscii = 13 Then > Command1.SetFocus > End If > End Sub > > Semoga membantu > > mario <[EMAIL PROTECTED]> wrote: > Permisi semua nya. > > Saya minta bantuan temen-temen sekalian, > Saya mw validasi agar input hanya berupa angka! > Ato berupa "tombol enter" > > > Sedikit codingnya: > > > Private Sub Text3_Keypress(KeyAscii As Integer) > If (Not KeyAscii >= Asc("0") Or Not KeyAscii <= Asc("9")) _ > Or KeyAscii <> Asc(vbBack) Or Not KeyAscii = 13 Then > MsgBox "Input harus berupa angka", vbOKOnly, "Warning" > Text3.Text = "" > End If > If KeyAscii = 13 Then > Command1.SetFocus > End If > End Sub > > Bagaimana yah??? > Klo pake coding ini, walaupun input nya = angka 0-9 > Tetap akan menuju msgbox. > > Trima kasih buat pencerahannya > > > > > > > > --------------------------------- > Never miss a thing. Make Yahoo your homepage. >
