Combobox List population
-
I have a combobox attached to a database with names in it. How do I get the combolist to show only the name of the text typed as it is type. IE: If I type "A" I want the list to display only the names that start with the letter "A". I was able to do this in the VB6 but lost the function when I upgraded to Visual Studio 2010. Please help!!!!
cjscs
-
I have a combobox attached to a database with names in it. How do I get the combolist to show only the name of the text typed as it is type. IE: If I type "A" I want the list to display only the names that start with the letter "A". I was able to do this in the VB6 but lost the function when I upgraded to Visual Studio 2010. Please help!!!!
cjscs
Not to hard to add the functionality. Have a start here[^].
Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
-
I have a combobox attached to a database with names in it. How do I get the combolist to show only the name of the text typed as it is type. IE: If I type "A" I want the list to display only the names that start with the letter "A". I was able to do this in the VB6 but lost the function when I upgraded to Visual Studio 2010. Please help!!!!
cjscs
The AutoComplete functionality Jorgen links you to is nice. But you might be asking for a simple way to filter your list items (which could be used in conjunction with AutoComplete). Have a look at the BindingSource class and its Filter property. Something like this:
Dim bs As New BindingSource
bs.DataSource = dtTable
Me.ComboBox1.DataSource = bs
Me.ComboBox1.DisplayMember = "DISPLAY_COLUMN"Private Sub ComboBox1\_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress bs.Filter = "DISPLAY\_COLUMN LIKE '" & e.KeyChar & "%'" End Sub