怎么样..?使用列表框项目快速计算文本框100行 [英] How..? fast way to compair textbox 100 lines with listbox items

查看:72
本文介绍了怎么样..?使用列表框项目快速计算文本框100行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hiii,我有一个文本框,其中包含至少1万字符,并且有一个列表框,其中包含5万行项目,我的问题是如何使用文本框更快地在列表框中对项目....我正在使用... 。

  dim  rohit  as   string  = textbox1.text 

for 每个 dd1 as string in database1.items

如果 rohit.contain(dd1)那么
msgbox()
else
msgbox()

next







但这种方法非常慢,15秒内15行文本框1024 ....



文本框数据来自文本文件

&

数据库数据也来自文本文件



这两个数据都是存储在窗体中,然后我使用按钮

搜索天气文本框字符匹配

与列表框项目....







提前感谢



需要紧急帮助......

截止日期即将结束....

解决方案

首先,你不应该在ListBox中存储50,000件物品:那种数量是只是为用户烦恼,因为他们无论如何都无法看到合理时间范围内的许多项目 - 所以摆脱它,想一种方法将文本存储在List或类似的内容中,并将摘要或提取显示到用户。然后,您可以开始使用哈希来提高搜索性能。



如果您的项目列表不包含重复项,请考虑使用 Hashset [ ^ ] - 无论元素数量多少,它的搜索性能几乎相同。

hiii , i have one textbox which contain atleast 1 lakh character and have one listbox which contain 50 thousand lines items , my question is what is the faster way to compair item in listbox with textbox .... i m using ....

dim rohit as string = textbox1.text

for each dd1 as string in database1.items

if rohit.contain (dd1) then
msgbox()
else
msgbox()

 next




but this method is very slow and compair 15 lines textbox 1024 within 15 sec ....
:
textbox data is coming from textfile
&
database data is also coming from textfile

both the data's are store in the form and then i used button
to search weather the textbox character match
with listbox items ....



thanks in advance

Need Urgent Help ...
Deadline is Coming close ....

解决方案

For starters, you shouldn't be storing 50,000 items in a ListBox anyway: that kind of quantity is just annoying for the user as they can't look at than many items in a reasonable timescale anyway - so get rid of it, and think of a way to store your text in a List or similar instead, with a summary or extract displayed to the user. You can then start to use hashes to improve your search performance.

If your list of items doesn't contain duplicates, then consider using a Hashset[^] instead - it's search performance is pretty much the same regardless of the number of elements.


这篇关于怎么样..?使用列表框项目快速计算文本框100行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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