Re: Typing in a ComboBox
- From: "Ken Tucker [MVP]" <vb2ae@xxxxxxxxxxxxx>
- Date: Wed, 12 Apr 2006 04:46:49 -0400
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/UserSamples/Details.aspx?SampleGuid=30138E02-C2C3-41CD-BC6A-09BC8FD2860B
Ken
----------------
"Helen Trim" <HelenTrim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:16CB8CFA-DB04-47B2-BF7C-BB3C64066E78@xxxxxxxxxxxxxxxx
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
--
Helen
.
- Prev by Date: Can you tell me if this makes sense?
- Next by Date: DataGrid update problem
- Previous by thread: Can you tell me if this makes sense?
- Next by thread: DataGrid update problem
- Index(es):
Relevant Pages
|
Loading