Trap double quotes in KeyDown [Resolved]
I want to trap the keystroke for double quotes and prevent the user from entering it in some text boxes. In VBA, the code would be like this:
VB Code:
If KeyCode = 34 Then
DoCmd.CancelEvent
After searching the forum, I came up with this for the vb.net version:
VB Code:
Private Sub txtModName_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtModName.KeyDown
If Asc(e.KeyCode) = Keys.OemQuotes Then
e.Handled = False
End If
End Sub
But it doesn't work. When I put a breakpoint in and check the e.keycode, it shows the Shift key used to get the doublequotes; oemquotes is 222. How can I trap this? Thanks.