Results 1 to 4 of 4

Thread: keyChar question (resolved by pirate)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    US
    Posts
    68

    keyChar question (resolved by pirate)

    how would i set the keyascii value to 0 to not allow the ' mark to be typed in a textbox? i have the following


    Private Sub txtFullName_Press(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtFullName.KeyPress

    If Asc(e.KeyChar()) = 44 Then
    Asc(e.KeyChar) = (0) ' <~~~ ??????
    End If

    End Sub
    Last edited by NeonBurner; Dec 19th, 2003 at 08:42 PM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Something like this
    VB Code:
    1. Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    2.         If Asc(e.KeyChar()) = 44 Then
    3.             e.Handled = True
    4.         End If
    5.     End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    US
    Posts
    68
    works great, thanx

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Anytime .

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