Results 1 to 10 of 10

Thread: [2005/2008] Change what user clicked on his/her keyboard.

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    [2005/2008] Change what user clicked on his/her keyboard.

    Hello, i have always thought to cancel a key a user pressed, you can just write e.Handled = False. I was wrong...

    Below is a quick example of making it so in a textbox if the user clicks the period/decimal it will not enter the period/decimal in the textbox it will enter a comma.

    vb Code:
    1. Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
    2.         If e.KeyCode = Keys.OemPeriod Or e.KeyCode = Keys.Decimal Then
    3.             e.SuppressKeyPress = True
    4.             SendKeys.Send(",")
    5.         End If
    6.     End Sub

    You can use the above code as a layout, modify it etc...
    Last edited by noahssite; Oct 31st, 2008 at 06:12 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