VS 2013 vb.net how to autocomplete textbox with a datatable-VBForums
Results 1 to 2 of 2

Thread: vb.net how to autocomplete textbox with a datatable

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2016
    Posts
    6

    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.

  2. #2
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,309

    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.