I'm here with a problem because of the maximum size of AutoCompleteSource. What I need to put in the source exceeds the maximum size, so I thought about other solution. Put all the strings into a List(of String) and when user type the first letter in the Textbox, it would call the AutoComplete function starting with that letter only.
Dim all_ As New List(Of String) Dim list__ As New AutoCompleteStringCollection() Dim initial_ As String = TextBox1.Text.Substring(0, 1) For i As Integer = 0 To all_.Count - 1 If all_(i).StartsWith(initial_) Then list__.Add(all_(i)) End If Next TextBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource TextBox1.AutoCompleteCustomSource = list__
The all_(List(Of String)) could contain "Hello, Hallo, Helz, ABC, ABL", if I type "H" in the Textbox, the list__(AutoCompleteStringCollection()) will only have: "Hello, Hallo, Helz".
Well, in theory this works. Because I made some loops through list__ and the values are correct, however in the Textbox doesn't appear the SuggestAppend. I'm putting this code in the TextChanged Event.