Tuesday, February 14, 2012

Only digit in text box in vb.net

Public Function TrapKey(ByVal KCode As String) As Boolean

If (KCode >= 48 And KCode <= 57) Or KCode = 8 Or KCode = 46 Then

'The AsCII values for numbers are between 48 to 57 and ASCII value 8 is for BackSpace.

TrapKey = False

Else

TrapKey = True

End If

End Function

No comments:

Post a Comment