Results 1 to 2 of 2

Thread: Reading F-keys on a Text box

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    6

    Reading F-keys on a Text box

    Does anyone know how to capture the f-keys in a Textbox

    I have tried the keypress event but the event does not fire when pressing any f-keys ie : F2
    'When all esle fails
    On Error Resume Next

  2. #2
    Hyperactive Member
    Join Date
    Apr 2003
    Location
    Three Rivers, MI
    Posts
    354
    StaticInc here is a cut and paste example of capturing the F4 key top open another form. This should be self explanatory but if you need more help just post back.

    VB Code:
    1. Public Sub capKeyDown_KeyDown(ByVal sender As Object, _
    2.         ByVal e As KeyEventArgs)
    3.  
    4.         Select Case e.KeyCode
    5.             Case Keys.F4
    6.                 If sender Is txtEmp Then
    7.                     Dim newForm As New frmShowEmp
    8.                     newForm.ShowDialog()
    9.                 ElseIf sender Is txtJobNumber Then
    10.                     Dim newForm As New frmShowJob
    11.                     newForm.ShowDialog()
    12.                 End If
    13.         End Select
    14.  
    15.     End Sub
    16.  
    17.     Private Sub txtEmp_KeyDown(ByVal sender As Object, _
    18.         ByVal e As System.Windows.Forms.KeyEventArgs) _
    19.         Handles txtEmp.KeyDown
    20.  
    21.         capKeyDown_KeyDown(txtEmp, e)
    22.  
    23.     End Sub

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