Wilson,
You need to handle the KeyPress event. You check for whatever key you want to trap and then you can set the Handled property of the KeyEventArgs instance passed to your method to true and it will indicate that you have handled the event (and you do nothing, of course).
This example traps the Enter key:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
e.Handled = True
End If
End Sub
>How do i cancel a Key stroke in .NET. like in VB 6 by asigning 0 to the KeyAscii variable.
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi