how to restrict textbox from accepting chars. it should only accept numerics.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • katarnak
    New Member
    • Mar 2008
    • 1

    how to restrict textbox from accepting chars. it should only accept numerics.

    how to do that.

    please if possible mail this solution to my mail id

    mail id removed
    Last edited by debasisdas; Mar 19 '08, 07:07 AM. Reason: removed maid id
  • anuragshrivastava64
    New Member
    • Jan 2007
    • 66

    #2
    [code=vb]
    Private Sub Text1_KeyPress( KeyAscii As Integer)
    If (KeyAscii > 47 And KeyAscii < 58) Or KeyAscii = 46 Or KeyAscii = 8 Then
    KeyAscii = KeyAscii
    Else
    KeyAscii = 0
    End If
    End Sub
    [/code]
    KeyAscii "8" is for backspace
    and keyascii "46" for decimal
    Use them if reqd
    Last edited by debasisdas; Mar 19 '08, 07:10 AM. Reason: added code=vb tags

    Comment

    Working...