Typing in a ComboBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way of getting a combo box to move to an item as the user types?
For example, if they type FR in a country list, it scrolls down to France.
This is the usual way that a combo box works, but it doesn't seem to happen
in VB .NET. Do I have to add code to get it to do this or is there a
property setting that allows this?

TIA
 
Hi,

In vb 2005 the combobox has some autocomplete functions to help with
that.

Dim strConn As String
Dim da As SqlDataAdapter
Dim conn As SqlConnection
Dim ds As New DataSet

strConn = "Server = .;Database = NorthWind; Integrated Security =
SSPI;"
conn = New SqlConnection(strConn)

da = New SqlDataAdapter("Select * from Products", conn)

da.Fill(ds, "Products")

Dim ac As New AutoCompleteStringCollection
For Each dr As DataRow In ds.Tables("Products").Rows
ac.Add(dr.Item("ProductName").ToString)
ComboBox1.Items.Add(dr.Item("ProductName").ToString)
Next


ComboBox1.AutoCompleteMode = AutoCompleteMode.Append
ComboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
ComboBox1.AutoCompleteCustomSource = ac


For vb.net and vb.net 2003 try using the intellicombo
http://www.gotdotnet.com/Community/...mpleGuid=30138E02-C2C3-41CD-BC6A-09BC8FD2860B

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

ComboBox 3
Data Bound Combobox SelectedIndex 1
Combobox in datagridview 2
combobox question 1
CallByName w/ComboBox 1
Access Combobox in Access Visible based on Checkbox 0
Combobox ItemData ? 2
Enter text in a Combobox 2

Back
Top