I wanted to implement an autocomplete feature on the combobox where you
would type in partial text and it would try to match it for you. It
doesn't exist in .Net yet, but I'm guessing it will in the next
version.
Here are instructions how to do it:
http://support.microsoft.com/default...b;en-us;320107
There is one bug, though.
If you click the expansion error and then type text into the dropdown
entry box to find a match entry, the new value will not be saved by the
ComboBox. For some reason even though the values are registered on the
SelectedIndexChanged event, the new selected values are lost by the
LostFocus event.
I found one solution that reset the values in the LostFocus event but
it didn't work for me. What did work for me was doing this:
Private Sub AutoComboBox_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
MyBase.SelectedIndexChanged
' Need to maintain the selected values internally due to
combobox selection bug
m_selectedIndex = Me.SelectedIndex
m_selectedValue = Me.SelectedValue
m_selectedText = Me.Text
End Sub
Which maintains the values internally upon the selectedIndexChanged
event. And then reset it in the LostFocus event:
Private Sub AutoComboBox_LostFocus(ByVal sender As Object, ByVal e
As System.EventArgs) Handles MyBase.LostFocus
' Need to set the selected values internally due to combobox
selection bug
Me.SelectedIndex = m_selectedIndex
Dim valType As Type = m_selectedValue.GetType()
Dim val2Type As Type = Me.SelectedValue.GetType()
If Not m_selectedValue Is Nothing And valType Is val2Type Then
Me.SelectedValue = m_selectedValue
End If
Me.Text = m_selectedText
End Sub