Private Sub autocus()
Call main()
Con.Open()

Dim cmd As New SqlCommand("SELECT cust_order FROM Inventory", Con)

Dim ds As New DataSet
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds, "My List") 'list can be any name u want

Dim col As New AutoCompleteStringCollection
Dim i As Integer
For i = 0 To ds.Tables(0).Rows.Count - 1
col.Add(ds.Tables(0).Rows(i)("cust_order").ToString())
Next
txt4.AutoCompleteSource = AutoCompleteSource.CustomSource
txt4.AutoCompleteCustomSource = col
txt4.AutoCompleteMode = AutoCompleteMode.Suggest
Con.Close()

End Sub

Reverend Jim commented: No context. Don't know if this is a question or sample code. -2

Recommended Answers

All 2 Replies

Is this a sample of code that works or is it a piece of code that you are having a problem with?

If it is the first then you should explain what it does and how. If it is the second then you should explain what you are trying to do and what you are having a problem with.

Didn't intend to ding your rep. If you make another post here I'll offset it with a positive vote.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.