PC Review


Reply
Thread Tools Rate Thread

ComboBox loads slow

 
 
0to60
Guest
Posts: n/a
 
      18th Oct 2007
I am noticing that it seems to take windows a long ass 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.


 
Reply With Quote
 
 
 
 
Robbe Morris - [MVP] C#
Guest
Posts: n/a
 
      18th Oct 2007
I'm assuming you are using databinding which is slow.
Load the ComboBox manually...

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

--
Robbe Morris [Microsoft MVP - Visual C#]
..NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorials...d-control.aspx




"0to60" <(E-Mail Removed)> wrote in message
news:%23ZC%(E-Mail Removed)...
>I am noticing that it seems to take windows a long ass 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.
>


 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      19th Oct 2007
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

"0to60" <(E-Mail Removed)> a écrit dans le message de news:
%23ZC%(E-Mail Removed)...
>I am noticing that it seems to take windows a long ass 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.
>



 
Reply With Quote
 
Mr. Arnold
Guest
Posts: n/a
 
      20th Oct 2007

"0to60" <(E-Mail Removed)> wrote in message
news:%23ZC%(E-Mail Removed)...
>I am noticing that it seems to take windows a long ass 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.
>


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.

 
Reply With Quote
 
Bob Powell [MVP]
Guest
Posts: n/a
 
      28th Oct 2007
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

--
--
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.


"0to60" <(E-Mail Removed)> wrote in message
news:%23ZC%(E-Mail Removed)...
>I am noticing that it seems to take windows a long ass 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.
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ComboBox loads slow 0to60 Microsoft Dot NET Framework 4 28th Oct 2007 04:25 PM
ComboBox loads slow 0to60 Microsoft Dot NET Framework Forms 4 28th Oct 2007 04:25 PM
Help Combobox selected value when form loads. Bob Microsoft ADO .NET 2 19th Aug 2005 11:04 AM
ComboBox opens before report loads =?Utf-8?B?RG9ubmE=?= Microsoft Access Reports 5 18th Apr 2005 04:36 AM
Internet Explorer loads pages fine, but loads pop-ups slow Joe Windows XP Internet Explorer 1 11th Sep 2003 02:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:46 AM.