0

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.

3
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by vb5prgrmr
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.