vb.net how to autocomplete textbox with a datatable
I've this code:
Code:
TextBox1.AutoCompleteMode = AutoCompleteMode.Append
TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
If dttest.Rows.Count > 0 < 2 Then
For counter As Integer = 0 To dttest.Rows.Count - 1
TextBox1.AutoCompleteCustomSource.Add(dttest.Rows(counter)("test"))
Next
For counter As Integer = 0 To dttest.Rows.Count = 328
If dttest.Rows(0).Item(0).ToString = TextBox1.Text Then
.....
End If
But textbox doesn't get the autocomplete mode, in this way, it need only to check the rows of datatable, and if find correct match with one on textbox then append the left text.
Re: vb.net how to autocomplete textbox with a datatable
Hello, I have on MSDN code samples an example of reading data from a database table and using the data to setup auto-complete for a TextBox. The code to setup autocomplete is in DataAccess.vb and implemented in MainForm.vb. I've added additional functionality to autocomplete too. Hopefully this is what you are after