Click here to Skip to main content
14,878,761 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

A Combobox assigned autocomplete feature in it,
set AutoCompleteMode to suggestappend, and AutoCompleteSource to List items.

i have written a code block in the keypress event of the combobox,like when enter key is pressed, do some action.

the keypress event doesn't fires. for enter key.

Without autocomplete feature assigned, the keypress event fires.

the basic trouble i am losing my enter key sequence for my code.

i.e., instead of tab key to move to next field, using enter key to move to next field.
give idea to rectify this error
Posted
Updated 23-Jul-12 1:15am
v2
Comments
bbirajdar 23-Jul-12 7:59am
   
How can we suggest unless we know what code you have written?
ZurdoDev 23-Jul-12 10:29am
   
Code?
Sergey Alexandrovich Kryukov 23-Jul-12 10:54am
   
To start with, you should tell use the exact type of your ComboBox control -- there are more then one under this simple name. At least give us a fully-qualified name (with namespace).

And yes, try to make a code sample to reproduce the problem.
--SA

1 solution

Use the KeyDown event

VB
Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
    If e.KeyCode = Keys.Enter Then
        ' if you want to simulate a tab,
        SendKeys.Send(vbTab)
    End If
End Sub
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900