文本框自动完成帮助 [英] Text box auto complete help
问题描述
大家好,
我正在研究内部项目,需要从数据库加载或建议数据。我必须只使用文本框(不使用组合框)这样做因为我不能预加载数据和附加数据在数据库中的数量非常高,因为它是170万行。我需要在动态文本框的Text_Changed上执行此操作。但是,Windows默认(文本框自动完成)正在帮助我。但加载建议的宽度限制为文本框长度。我需要这个列表宽度应至少为600,因为数据库中的数据长度为200个字符。我需要显示至少100个字符。
我正在使用
C#winforms UI。
.net 2.0框架。
SQL Compact DB 4.0
期待来自心爱的程序员的帮助。
我尝试了什么:
我尝试过使用Auto的Windows默认文本框完成。但是,长度限制为文本框长度。
Hi All,
I am working on a internal project and need to load or suggest data from database. I have to do this using Text box only (not with Combo box) As i cannot pre load data and attach as data in DB is very high in number as it is 1.7 million rows. I need to do it on Text_Changed of text box Dynamically. However, windows default (Text Box Auto Complete) is helping me with this. But the width of loading suggestions are restricting to Text box length. I need this list width should be at least 600 as data from database is long of 200 characters. I need to show at least 100 chars.
I am using
C# winforms UI.
.net 2.0 framework.
SQL Compact DB 4.0
Looking forward for help from beloved coders.
What I have tried:
I have tried Windows default text box with Auto Complete. But, Length is restricting to text box length.
推荐答案
你好,
我不确定我完全理解你的问题但是我我想我做过类似的事情。也许你可以根据自己的需要调整它。
我的解决方案基于这个例子
在C#中键入时搜索
当我输入搜索文本框下面的数据网格列出了所有匹配的项目,键入的越多,数据网格中的匹配项就越少。我用这个来分类10,000多个联系人姓名和地址,找到并选择我想要的名字和地址。有点像谷歌搜索的工作原理。代码简单而且非常快。
祝你好运,我希望这个想法可以帮到你。
David
Hi There,
I'm not sure I fully understand your question but I think I have done something similar. Maybe you can adapt it to your needs.
I based my solution on this example
Search As You Type in C#
When I type in the search text box a data grid below lists all the matching items the more you type the fewer matches there are in the data grid. I used this to sort through 10,000+ contact names and addresses to find and select the one I want. Kind of like how Google search works. The code is surprisingly simple and very quick.
Good Luck and I hope this idea helps you.
David
这篇关于文本框自动完成帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!