Results 1 to 10 of 10

Thread: Trap double quotes in KeyDown [Resolved]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    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:
    1. If KeyCode = 34 Then
    2.     DoCmd.CancelEvent
    After searching the forum, I came up with this for the vb.net version:
    VB Code:
    1. Private Sub txtModName_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtModName.KeyDown
    2.         If Asc(e.KeyCode) = Keys.OemQuotes Then
    3.             e.Handled = False
    4.         End If
    5.     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.
    Last edited by salvelinus; Dec 16th, 2003 at 11:06 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width