Sir,
I am trying to write a function which check that the numeric key is pressed and if not returns null/blank in the textbox and on write key writes the value
so the event and functions are as follows :
Private Sub txtloanamt_KeyPress(keyascii As Integer)
ky = keyascii
keyascii = checknumber(ky)
End Sub
Public Function checknumber(ky) As Integer
If ky < 48 Or ky >= 65 Then '65=capital A and 122=small letter z
MsgBox "Please enter only numeric value"
keyascii = 0
Else
ky = ky
End If
End Function
Pl. give correction and guide me.
thanks
I am trying to write a function which check that the numeric key is pressed and if not returns null/blank in the textbox and on write key writes the value
so the event and functions are as follows :
Private Sub txtloanamt_KeyPress(keyascii As Integer)
ky = keyascii
keyascii = checknumber(ky)
End Sub
Public Function checknumber(ky) As Integer
If ky < 48 Or ky >= 65 Then '65=capital A and 122=small letter z
MsgBox "Please enter only numeric value"
keyascii = 0
Else
ky = ky
End If
End Function
Pl. give correction and guide me.
thanks