Solved

VB.Net - Loading large amounts of data into a combobox.

Posted on 2007-04-10
1
1,281 Views
Last Modified: 2008-01-09
Hello,
I have a VB.Net application in which I have several comboboxes on a form that contain a large about of data, about 13,000 rows each.  The query which retrieves the data is very fast.  Here is an example of my code that populates  8 combo boxes.
 
dsDxs = cCSharedFunction.getDx()
dsDX1 = dsDxs.Copy()
dsDX2 = dsDxs.Copy()
dsDX3 = dsDxs.Copy()
dsDX4 = dsDxs.Copy()

With UcDx1.cmbDX1
            .DataSource = dsDX1.Tables(0)
            .DisplayMember = "Dx"
            .ValueMember = "Description"
End With

With UcDx1.cmbDX1Desc
            .DataSource = dsDX1.Tables(0)
            .DisplayMember = "Description"
            .ValueMember = "Dx"
End With

With UcDx1.cmbDX2
            .DataSource = dsDX2.Tables(0)
            .DisplayMember = "Dx"
            .ValueMember = "Description"
End With

With UcDx1.cmbDX2Desc
            .DataSource = dsDX2.Tables(0)
            .DisplayMember = "Description"
            .ValueMember = "Dx"
End With

With UcDx1.cmbDX3
            .DataSource = dsDX3.Tables(0)
            .DisplayMember = "Dx"
            .ValueMember = "Description"
End With

With UcDx1.cmbDX3Desc
            .DataSource = dsDX3.Tables(0)
            .DisplayMember = "Description"
            .ValueMember = "Dx"
End With

With UcDx1.cmbDX4
            .DataSource = dsDX4.Tables(0)
            .DisplayMember = "Dx"
            .ValueMember = "Description"
End With

With UcDx1.cmbDX4Desc
            .DataSource = dsDX4.Tables(0)
            .DisplayMember = "Description"
            .ValueMember = "Dx"
End With

Any help to speed up the load of these controls would be greatly appreciated.

Thanks in advance.
0
Comment
Question by:mocaiv
1 Comment
 
LVL 22

Accepted Solution

by:
_TAD_ earned 500 total points
ID: 18883210

13,000 rows in a combo box?  That just doesn't sound like a good idea.  I mean, the whole idea behind a combo box is to allow someone to choose a value.  Choosing from 13,000 possible choices is just too much.

However, that being said, if you really want to improve performance you need to first look at your CPU usage and RAM usage.  If CPU is at 100% and RAM is swapping pages like crazy during this process, then there is nothing you can do.

On the other hand, if CPU and RAM are low throughout the loading process, then I would suggest multi-threading your application.

Create a delegate that will do the databinding for you.  That way you don't have to wait for each one to complete before starting the next one.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now