具有TextBox.Text“收听";进行更改,然后执行代码? [英] Having a TextBox.Text "listen" for changes then execute code?
本文介绍了具有TextBox.Text“收听";进行更改,然后执行代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在寻找一种方法,让文本框检测其文本在运行时被更改,然后执行代码(有延迟).我基本上是想根据用户在文本框中写的内容来显示一个带有名称建议的下拉框.
我没有任何代码,因为我只是在寻找这个功能,没有巫婆,我不会打扰下拉列表和数据库交互.
I''ve been looking for a way to have a textbox detect that it''s text is being changed during runtime and then executing code, (with a delay). I''m basically want to making a dropdown box appear with name suggestions according to what the user writes in the textbox.
I havn''t any code, as I''m just looking for this functionality, without witch, I won''t bother doing the dropdown and database interactions.
For clarification:
When the user types in "a" all db-objects with a name starting with an "a" gets listed, but only if the user haven't typed another character for 1 second. (so when a character is typed it starts the method, with has a delay it counts through, if it's interrupted by another character it resets, all the while having the contents of the textbox as a variable to use when it gets to count down to zero and executes the dropbox functions).
That's the functionality I'm going for
感谢您帮助菜鸟们!
-frank
Thanks for helping a noob!
-frank
推荐答案
您可以使用TextBox
的AutoComplete
功能来执行此任务.请参考以下链接:
http://idpkshr.wordpress.com/2012 /03/31/autosuggest-textbox-from-database-column-in-windows-forms/ [
Hi,
You can useAutoComplete
feature of theTextBox
to perform this task. Refer to the following link:
http://idpkshr.wordpress.com/2012/03/31/autosuggest-textbox-from-database-column-in-windows-forms/[^]
这篇关于具有TextBox.Text“收听";进行更改,然后执行代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文