473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ComboBox Autocomplete feature

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

Nov 21 '05 #1
0 1733

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

40
by: Alex | last post by:
Hello, does anybody know how to turn off the autocomplete feature for a certain text field? I am aware of the "autocomplete" attribute, but I have seen other implementions achieving it...
2
by: VM | last post by:
How can I implement the autocomplete functionality in a Windows comboBox? Thanks.
3
by: RajW | last post by:
Is it possible to have an auto complete ComboBox in ASP.NET? I would like to create a ComboBox that functions similarly to the way that IE will try to autocomplete a URL as you type it in. ...
19
by: Bernie Yaeger | last post by:
Everyone misses the point on this - what we need is a combobox autocomplete that is a dropdownlist only. When in dropdown mode, you can enter text - making that autocomplete is trivial. But when...
2
by: Becker | last post by:
I have a need for a simple combobox on a form in one of my programs that represents city, state. I want to have it autocomplete as the user types. I have a table with these values (about 50k of...
2
by: Kalvin | last post by:
I found some code in Google, don't remember where, for an AutoComplete combobox. Everything is great with it except for one thing. If I use the mouse to drop the list down, then start typing to...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I have to load 30,000 unique names into a combox. Filling a dataTable takes only a few milliseconds. But populating the combobox and displaying the list takes several seconds - way...
6
by: ezyeric13 | last post by:
I have a series of ComboBox's Bound to a DataGridView and I turned the AutoComplete on for them so they list all the items in a certain collumn of the DataGridView. The problem is that when you...
0
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi - I've been searching around for a fix but can't find one... There is a bug with combobox autocomplete suggestappend. When text has a slash, "ab/cd" for example, the autocomplete feature cuts...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.