2 Replies - 450 Views - Last Post: 22 February 2012 - 03:01 PM Rate Topic: -----

#1 Keylogger  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 279
  • Joined: 14-February 11

AutoComplete

Posted 22 February 2012 - 01:56 PM

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

Is This A Good Question/Topic? 0
  • +

Replies To: AutoComplete

#2 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1397
  • View blog
  • Posts: 4,494
  • Joined: 25-September 09

Re: AutoComplete

Posted 22 February 2012 - 02:45 PM

Here's a topic I started a while back that might help.
Was This Post Helpful? 0
  • +
  • -

#3 Keylogger  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 279
  • Joined: 14-February 11

Re: AutoComplete

Posted 22 February 2012 - 03:01 PM

View PostCharlieMay, on 22 February 2012 - 02:45 PM, said:

Here's a topic I started a while back that might help.

Well, that help when you said "I have 10000 records..".

Because I tried to copy and past my 3000 records directly into the source, and it only accepts 2000 (example), as a result I never thought about put it by code, because I thought it won't work either, but it works.

Thanks.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1