在vb.net自动完成的文本框的建议 [英] Auto complete textbox suggestions in vb.net

查看:331
本文介绍了在vb.net自动完成的文本框的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现自动完成在vb.net文本,但有一个问题,当用户键入的东西在文本框中自动完成建议列表闪烁并消失一样,如果重点变成

I implemented auto complete in vb.net textbox , but there is an issue that when user types something in text box the auto complete suggestion list blinks and disappears like if the focus changed

这里是code:

        Dim Bl As New ItemBL
        Dim suggestions = DAL.DisplayLikeNameList(Trim(MyTextBox.Text))
        Dim MySource As New AutoCompleteStringCollection()
        MySource.AddRange(suggestions.ToArray)

        With MyTextBox
            .AutoCompleteCustomSource = MySource
            .AutoCompleteMode = AutoCompleteMode.Suggest
            .AutoCompleteSource = AutoCompleteSource.CustomSource
        End With
    End If

我相信,在MDI窗体的问题,因为它具有以上code后执行定时code:

I believe the problem in Mdi form because it has timer code executed after the above code :

 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    LblDateAndTime.Text = Now
End Sub

注:自动完成code是不是在MDI窗体子窗体执行,你有什么建议继续建议列表粘在文本框中输入用户书写?

Note: the auto complete code is executed in a child form not in the Mdi Form , what do you suggest to keep suggestions list "sticky" as the user writing in the text box ??

推荐答案

我解决了问题,

这code写于
    KEY_UP 事件
但现在我写在 Text_Changed 事件和它的工作

This Code was written in Key_Up event but now I wrote it in Text_Changed Event and it worked

这篇关于在vb.net自动完成的文本框的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆