Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2007

Tip: Looking for answers? Try searching our database.

ComboBox loads slow

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
0to60 - 18 Oct 2007 18:29 GMT
I am noticing that it seems to take windows a long a.s time to paint a
ComboBox control that has say, 32000 items in its dropdown.  Yes, I know
that's a lot.  However, I have a VB6.0 application that uses DAO to access
an Access database, and it can load up a 32000 item combobox in a fraction
of the time it takes .net 2.0.  Why is this?

Also, it seems like setting the .DataSource property takes a while, but the
bulk of the wait time is when the control gets drawn on the screen.
Robbe Morris - [MVP] C# - 18 Oct 2007 20:12 GMT
I'm assuming you are using databinding which is slow.
Load the ComboBox manually...

32k items in a ComboBox is just nuts...

Signature

Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorials/aspnet/270e9432-d236-47e7-b1af-5cd3abe27a75
/net-propertygrid-control.aspx


>I am noticing that it seems to take windows a long a.s time to paint a
>ComboBox control that has say, 32000 items in its dropdown.  Yes, I know
[quoted text clipped - 4 lines]
> Also, it seems like setting the .DataSource property takes a while, but
> the bulk of the wait time is when the control gets drawn on the screen.
Patrice - 19 Oct 2007 09:28 GMT
This is likely because it is refreshed each time you add an element. You
could use AddRange to add all items at once or try
SuspendLayout/ResumeLayout to avoid refreshing the control each time.

You may want also to check if another UI would be more efficient for the
users...

As a side note please avoid to post in too many groups...

--
Patrice

>I am noticing that it seems to take windows a long a.s time to paint a
>ComboBox control that has say, 32000 items in its dropdown.  Yes, I know
[quoted text clipped - 4 lines]
> Also, it seems like setting the .DataSource property takes a while, but
> the bulk of the wait time is when the control gets drawn on the screen.
Mr. Arnold - 20 Oct 2007 14:26 GMT
>I am noticing that it seems to take windows a long a.s time to paint a
>ComboBox control that has say, 32000 items in its dropdown.  Yes, I know
[quoted text clipped - 4 lines]
> Also, it seems like setting the .DataSource property takes a while, but
> the bulk of the wait time is when the control gets drawn on the screen.

Don't bind it do it manually. I'll assume  you're doing it manually with
VB6.  Also, if some reader is coming into play on the binding, then the
reader has to go back a read more records, instead of you loading the data
in an Arrylist and bind the Arraylist to the control. All the data is in
memory in the Arraylist, which is faster.
Bob Powell [MVP] - 28 Oct 2007 17:25 GMT
As Robbe suggests this is a ridiculous amount of items to store in a combo.
Also you may be suffering from the effect of the databinding problem I
describe in the following article...

http://www.bobpowell.net/ComboBinding.htm

Signature

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

>I am noticing that it seems to take windows a long a.s time to paint a
>ComboBox control that has say, 32000 items in its dropdown.  Yes, I know
[quoted text clipped - 4 lines]
> Also, it seems like setting the .DataSource property takes a while, but
> the bulk of the wait time is when the control gets drawn on the screen.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.