Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using vb.net in windows application. I need to bind user name from database into text box autocomplete, when I click radio button.

In Form Load event autocomplete working fine but after radio button click even its not working.

Any one can able to help me

VB
Public Sub getData(ByVal dataCollection As AutoCompleteStringCollection)
        ds = New Dataset()
        Dim sql As String = "SELECT DISTINCT [MAC] FROM [Customer]"
        Try
            con.Open()
            com = New OleDbCommand(sql, con)
            adap.SelectCommand = com
            adap.Fill(ds, "Macnumber")
            adap.Dispose()
            com.Dispose()
            con.Close()
            For Each row As DataRow In ds.Tables("Macnumber").Rows
                dataCollection.Add(row(0).ToString())
            Next
        Catch ex As Exception
            MessageBox.Show("Can not open connection ! ")
        End Try
    End Sub

The below coding I was added in Radio Button Checked Changed event.
Instead of changed event if I was included that code in form load event it was working fine.

But I want radio button click event. Because same text box i like to bind user name and mac number if I clicked user name radio button username need to autocomplete. If I clicked mac number mac number need to suggest in same text box. That's why i prepare to call this below coding in radio button click event.


txtmacno.AutoCompleteMode = AutoCompleteMode.Suggest
txtmacno.AutoCompleteSource = AutoCompleteSource.CustomSource
Dim DataCollection As New AutoCompleteStringCollection()
getData(DataCollection)
txtmacno.AutoCompleteCustomSource = DataCollection


Thanks you

Bala
Posted
Updated 4-Apr-15 2:12am
v2
Comments
Abhinav S 4-Apr-15 6:13am    
Can you post some code here?

1 solution

Add your solution first then i can try to find the solution
 
Share this answer
 
Comments
sbsmanian 4-Apr-15 8:14am    
please check my updated question.

let me know how to solve this problem

Thank You

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900