Hello,
I need to autocomplete for a textbox.
If i type 'a" in textbox means, it must show the dropdown list showing all words starting with a.
Like that for all the alphabets.

It must show the words based on the user typed words before.

Suppose when the user first time login and type admin means, it must stores that word and the next time when the user simply type a means it must show admin.
Thanks in advance.

Place this code in your Form_Load event
suppose the textbox will store all the descriptions of our products.

Dim stringCols As New AutoCompleteStringCollection
        Dim str As String = "SELECT DISTINCT description FROM products ORDER by description asc"
        Dim cmdStr As New Odbc.OdbcCommand(str, conn)
        Dim dtreader As Odbc.OdbcDataReader = cmdStr.ExecuteReader()

        While dtreader.Read
            stringCols.AddRange(New String() {dtreader(0)})

        End While
        dtreader.Close()
        txtDescription.AutoCompleteCustomSource = stringCols

hope it help

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.