Results 1 to 3 of 3

Thread: [RESOLVED] Format a char from e.KeyCode etc.

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Posts
    99

    [RESOLVED] Format a char from e.KeyCode etc.

    I have a keydown event that looks like this

    VB Code:
    1. If e.KeyCode <> Windows.Forms.Keys.Up And e.KeyCode <> Windows.Forms.Keys.Down And e.KeyCode <> Windows.Forms.Keys.Enter Then
    2.             Me.txtSearchBox.Focus()
    3.             Me.txtSearchBox.Text = e.KeyCode.ToString
    4.             Me.txtSearchBox.SelectionStart = 1
    5.         End If

    This works fine, except for when you use the number pad. For instance, if you hit '2' on the number pad, the textbox would show 'NumPad2'. I want it to just display the '2'. I have tried e.KeyCode, e.KeyData, e.KeyValue, and all of their ToString() functions, but none of them return what I want. Does anyone know how I can fix this?

    Thanks for any help!
    Last edited by thecow95; Jul 26th, 2005 at 12:41 PM.

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