semoga koding sederhana ini bisa membantu.............sory newbie juga
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii > 57 Or KeyAscii < 48 And KeyAscii <> 13 And KeyAscii <>
Asc(vbBack) And KeyAscii <> 27 Then
MsgBox "anda harus memasukkan angka"
KeyAscii = 0
End If
End Sub
muhammad adhi <[EMAIL PROTECTED]> wrote:
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.
>
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.