"=?Utf-8?B?TWljaGFlbCBHcmVlbg==?=" <Mi**********@discussions.microsoft.com>
wrote in news:5B**********************************@microsof t.com:
Hi,
In VB6 you used to be able to modify keys as they were pressed in the
KeyPress event e.g. change it uppercase, remove certain characters etc.
How do I do this in .NET ?
Regards
Michael
Texboxes have a charactercasing property to only allow upper/lower case if
desired.
They have a keypress event, put code in there to handle the keypress, e.g.:
Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e _
As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = "j" Then
'Tell the textbox the event has been handled
'and the character wont be displayed...
e.Handled = True
End If
End Sub