Re: Typing in a ComboBox



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


.



Relevant Pages

  • Re: Probably s Simple Question but ....
    ... Dim conn As SqlConnection ... Private Sub frmSystemOptions_Load(ByVal sender As System.Object, ... Dim RegKeyRead As RegistryKey ... Dim oSQLConn As SqlConnection = New SqlConnection ...
    (microsoft.public.dotnet.languages.vb)
  • Re: what is wrong with this
    ... Dim Conn As New SqlConnection("Data ... Dim queryString As String = "select code, value as Addr from ... DataTabledatatables, Int32 startRecord, Int32 maxRecords, String ...
    (microsoft.public.dotnet.languages.vb)
  • Re: best practice for inserting rows using a dataAdapter?
    ... Dim conn As new SqlConnection ... Dim da As new SqlDataAdapter ... empty DataSet that matches the table (strongly typed datasets are easier ... If you want to get an empty DataSet, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: best practice for inserting rows using a dataAdapter?
    ... Dim conn As new SqlConnection ... Dim da As new SqlDataAdapter ... If you want to get an empty DataSet, without using a strongly typed DataSet, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: multi thread vb app to pull data from webservice
    ... Public Function getXMLCallUp(ByVal userID As String) As ... Dim xmlDoc As New XmlDocument ... connectString As String) As DataTable ... Dim conn As New SqlConnection ...
    (microsoft.public.dotnet.languages.vb)

Loading