在将包含大量数据的数据集加载到Win窗体中的Combo Box时,提高性能 [英] Increase the performance while loading data set with huge data to Combo Box in Win forms

查看:79
本文介绍了在将包含大量数据的数据集加载到Win窗体中的Combo Box时,提高性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在尝试绑定一个数据集,该数据集的单列数量接近2万亿。现在,当我尝试将这个数据表绑定到组合框时,它需要花费很多时间......我的应用程序正在转向非重新启动状态一段时间。任何人都可以建议我来解决问题。



源代码:





Hi,

I am trying to bind a data set which has single column whose count is nearly 2lakhs. Now, when I tried to binding this datatable to Combo box its taking much time...more over my application is moving to "Not Reaponding State" for some time. Can any one suggest me to over come the issue.

Source Code:


this.ClassCodeComboBox.DisplayMember = classCodeDataTable.ClassCodeColumn.ColumnName;<br />
                    this.classCodeDataTable = this.form26000Control.WorkItem.F26000_ClassCodeDetails(parcelId).f26000ClassCode;<br />
<br />
                    if (classCodeDataTable.Rows.Count > 0)<br />
                    {<br />
                        this.ClassCodeComboBox.AutoCompleteMode = AutoCompleteMode.Suggest;<br />
                        this.ClassCodeComboBox.AutoCompleteSource = AutoCompleteSource.ListItems;<br />
                        this.ClassCodeComboBox.DataSource = classCodeDataTable;<br />
                        this.ClassCodeComboBox.Text = this.classCode;<br />
                        this.ClassCodeComboBox.Select(this.ClassCodeComboBox.Text.Length, 0);<br />
                    }







Win表单应用程序框架工作3.5,使用的控制:Combobox




Win forms Application Frame work 3.5, Used Control:Combobox

推荐答案

解决方案很简单:不要尝试使用那么多项加载任何UI元素。



想一想:如何您是否想要使用该软件并尝试在其他200,000个列表中找到您需要使用的一个选项?每天?可能每天好几次?



如果我试过,我的用户会讨厌我,不会使用我的软件,我也不会得到报酬。



找到一个解决方案,让他们更容易找到他们需要的东西:过滤器,团体,等等 - 但不要太懒! :笑:
The solution is simple: don't try to load any UI element with that many items.

Think about it: how you like to use that software and try to find the one selection you need to use in a list of 200,000 other ones? Every day? Probably several times every day?

If I tried that, my users would hate me, not use my software, and I wouldn't get paid.

Find a solution that lets them find what they need easier: filters, groups, whatever - but don't be so lazy! :laugh:


我会在这里输入jQuery自动完成并在服务器端为输入的每个x字符运行搜索,例如自动完成无效直到输入4个字符,然后将填充过滤列表。这样你就会得到一个过滤后的结果,它将会更加精致,不会让你的用户成为一个暴徒。



这意味着你'我需要添加一个服务,提供过滤后的内容并将其指定为您的数据源。我担心我不能告诉你如何最好地在Web窗体中做到这一点,但我可以告诉你,在MVC中它将是微不足道的。
I would crib from the jQuery autocomplete here and run a search on the server side for every x characters entered, for instance the autocomplete is inactive until 4 characters are entered, and then will populate with a filtered list. That way you have a filtered result coming in which will be substantially more refined and will not make your users rise up as a lynch mob.

This does mean that you'll need to add a service that will provide the filtered content and assign that as your data source. I'm afraid I can't tell you how best to do that off the top of my head in Web Forms, but I can tell you that in MVC it would be trivial.


这篇关于在将包含大量数据的数据集加载到Win窗体中的Combo Box时,提高性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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