Greeting,

Can somebody help me with this code i don't know what is the problem here

Dim str As String = "SELECT DISTINCT FirstName,LastName FROM SessionMembers ORDER by FirstName, LastName asc"
        Dim cmdStr As New SqlCommand(str, con)
        Dim dtreader As SqlDataReader = cmdStr.ExecuteReader()

        While dtreader.Read
            stringCols.AddRange(New String() {dtreader(0).ToString})
            stringCols2.AddRange(New String() {dtreader(1).ToString})
        End While
        dtreader.Close()
        LastNameTF.AutoCompleteCustomSource = stringCols2
        FirstNameTF.AutoCompleteCustomSource = stringCols
        FirstNameTF.AutoCompleteMode = AutoCompleteMode.SuggestAppend
        LastNameTF.AutoCompleteMode = AutoCompleteMode.SuggestAppend
        con.Close()

Thank you in advance.

Add this lines :

FirstNameTF.AutoCompleteSource = AutoCompleteSource.CustomSource
LastNameTF.AutoCompleteSource = AutoCompleteSource.CustomSource
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.