autoCompleteSource vb溢出?

时间:2016-09-29 20:37:37

标签: vb.net autocomplete textbox

我尝试在vb.net文本框中添加autoCompleteSource,以便显示建议列表。但是我得到了这个错误。 enter image description here

是不是因为我尝试在建议中添加超过300条记录。如果是这样,我该怎么做才能添加滚动条来显示建议中的记录。我想我是否需要创建自己的处理程序,如果这样你可以建议我添加滚动条以创建我自己的文本框自动完成的属性。

[UPDATE]

 Dim MySource As New AutoCompleteStringCollection()

        lst.Add("apple")
        lst.Add("applle")
        lst.Add("appple")
        lst.Add("appplee")
        lst.Add("bear")
        lst.Add("pear")

        'Records binded to the AutocompleteStringCollection.
        MySource.AddRange(lst.ToArray)

        'My own data source with 300 records

        Dim index(cmboList.Items.Count) As String
        For i As Integer = 0 To cmboList.Items.Count - 1
            If cmboList.Items.Count > 0 Then
                index(i) = cmboList.Items(i).ToString()
            End If
        Next
        MySource.AddRange(index.ToArray)

        txtExpressionBuilder.AutoCompleteCustomSource = MySource


        'Auto complete mode set to suggest append so that it will sugesst one
        'or more suggested completion strings it has bith ‘Suggest’ and
        '‘Append’ functionality
        txtExpressionBuilder.AutoCompleteMode = AutoCompleteMode.Suggest  ' SuggestAppend

        'Set to Custom source we have filled already
        txtExpressionBuilder.AutoCompleteSource = AutoCompleteSource.CustomSource

0 个答案:

没有答案