B
Baz
Hi All,
In VB6, I had text boxes which, in I wanted to allow numeric data
only. To do this, I put some code in the KeyPress event of the
control, and if the key that was entered was outside the range of 0-9,
then I reset the KeyAscii prperty to 0. Thus:
Private Sub tTransactionAmount_KeyPress(KeyAscii As Integer)
If Keyascii < 48 Or Keyascii > 57 Then Keyascii = 0
End Sub
How can I get the same effect in VB.NET? I tried doing something
similar in the KeyPress event, but the e.KeyChar value is read-only,
so I can't override it like I do the KeyAscii value in VB6.
Any thoughts?
Thanks,
Baz.
In VB6, I had text boxes which, in I wanted to allow numeric data
only. To do this, I put some code in the KeyPress event of the
control, and if the key that was entered was outside the range of 0-9,
then I reset the KeyAscii prperty to 0. Thus:
Private Sub tTransactionAmount_KeyPress(KeyAscii As Integer)
If Keyascii < 48 Or Keyascii > 57 Then Keyascii = 0
End Sub
How can I get the same effect in VB.NET? I tried doing something
similar in the KeyPress event, but the e.KeyChar value is read-only,
so I can't override it like I do the KeyAscii value in VB6.
Any thoughts?
Thanks,
Baz.