Vb.net +自动完成文本框中

编程入门 行业动态 更新时间:2024-10-23 23:20:48
本文介绍了Vb +自动完成文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

所以我在读在VB.NET文本框自动完成了一点,但我真的不能明白的地方,这些被存储?它是一个完全内置的功能,还是我必须写一些code为它工作?我发现文本框的 AutoCompleteMode 和 AutoCompleteSource 属性。但我想任何附加我写在文本框中自动完成源。难道我的源连接到 My.Settings 还是什么?难道不是我要使用一个数组中呢?任何帮助将是AP preciated:)

So I was reading a bit on AutoComplete of textboxes in VB.NET, but I can't really understand where these are stored? Is it a fully built in feature, or do I have to write some code for it to work? I've found the AutoCompleteMode and AutoCompleteSource properties of textboxes. But I want to append whatever I've written in the textbox to the autocomplete source. Do I connect the source to My.Settings or something? Wouldn't I have to use an array as well? Any help would be appreciated :)

推荐答案

您将有新的条目添加到您的手动自动完成数据源...这是有道理的,当你想想:如何为Windows窗体咋办要知道,当一个新的项应该被添加到建议列表,当输入的文本只是暂时的东西?

You would have to add new entries to your auto-complete data source manually... which makes sense, when you think about it: How is Windows Forms supposed to know when a new entry should be added to the list of suggestions and when the text entered is only something temporary?

您可以添加如新价值当输入字段的验证情况,或者当用户presses一个OK / Apply按钮,或任何适合你的最好的。但是,你必须这样做你自己。

You could add new values e.g. when validation of the input field happens, or when the user presses an OK / Apply button, or whatever fits your need best. But you will have to do this yourself.

您已经发现的属性是正确的。

The properties you've already discovered are the right ones.

Dim suggestions As New List(Of String) suggestions.Add("Abba") suggestions.Add("Nirvana") suggestions.Add("Rolling Stones") ... textBox.AutoCompleteSource = suggestions

您可以绑定 AutoCompleteSource 来几乎所有的东西;这是非常相似的数据绑定。有一点要记住的是,如果你要添加新条目自动完成数据源,UI控件可能不会立即注意到,如果你的数据源不落实 INotifyCollectionChanged 接口。

You can bind AutoCompleteSource to almost anything; this is very similar to data-binding. One thing to keep in mind is that if you're adding new entries to the auto-complete data source, the UI control might not immediately notice if your data source doesn't implement the INotifyCollectionChanged interface.

更多推荐

Vb.net +自动完成文本框中

本文发布于:2023-11-03 20:33:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1556018.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:框中   自动完成   文本   Vb   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!