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
 
Back
Top