Results 1 to 3 of 3

Thread: Combobox and F4 key

  1. #1
    SiX
    SiX is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Dec 2007
    Posts
    5
    Reputation
    0

    Combobox and F4 key

    Hi Guys

    I want to change the F4 key on the combo box in vb.net 2005

    By default, if the combo box has focus, and you press F4, it will open/drop down.

    F4 is already used in my program, is it possible to change the key to for example F5?

    Thank you very much.

  2. #2
    .paul. is offline VB.NET Forum Genius
    .NET Framework
    .NET 2.0
    Join Date
    May 2007
    Posts
    212
    Reputation
    100
    you can change the key to any key you choose

    Code:
    Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
         If e.KeyCode = Keys.F4 Then
             e.SuppressKeyPress = True
         ElseIf e.KeyCode = Keys.F5 Then
             If Not ComboBox1.DroppedDown = True Then
                 ComboBox1.DroppedDown = True
             Else
                 ComboBox1.DroppedDown = False
             End If
         End If
    End Sub

  3. #3
    SiX
    SiX is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Dec 2007
    Posts
    5
    Reputation
    0
    Thx man, works like a charm

Bookmarks

Posting Permissions

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