Kamis, 16 Desember 2010

validate textbox in vb.net

1.
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
2.
If (Microsoft.VisualBasic.Asc(e.KeyChar) < 48) _ 3. Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 57) Then
4.
e.Handled = True
5.
End If
6.
If (Microsoft.VisualBasic.Asc(e.KeyChar) = 8) Then
7.
e.Handled = False
8.
End If
9.
end sub

Tidak ada komentar:

Posting Komentar