0
votes

I'm having this really weird issue with ComboBoxes.

I have a ComboBox populated with entries from a database. However this issue isn't related to the database or it's contents.

When I press the down arrow on the ComboBox, and then type part of an items contents while SuggestAppend is turned on, it wipes the text rather than complete the line. If I just type then the issue doesn't occur. It's only when I drop the list first.

You can recreate this by creating a Combobox on an empty form. Give it a few items, set it's AutoCompleteSource to ListItems and AutoCompleteMode to SuggestAppend.

Now while running the application, drop the list, don't exit this list, just start typing part of an entry. Then press enter. It will wipe the contents of the combo box text.

Is there a way around this bug?

1
I don't know whether it is the behaviour you want, but you could add a KeyPress event to that combobox which will set YourComboBox.DroppedDown = False. This lets you only see the suggestion box and will not clear when you press enterA Friend
Please write this as the answer. It solved my problem and you are my hero.Kayot

1 Answers

1
votes

The issue only presents itself when both the suggestion box and the box containing the items are visible at the same time.

Add a KeyPress handler to your combobox and set the DroppedDown property to False like below:

Private Sub YourCombo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles YourCombo.KeyPress
    YourCombo.DroppedDown = False
End Sub

This will close the items box and keep the suggestions box visible. When you press enter it will no longer clear the text.