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
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