Windows Develop Bookmark and Share   
 index > Windows Forms General > create dinamically control is very slow__
 

create dinamically control is very slow__

Hello, I have some problem with my vb.net interface, I need to add dynamically in a window several controls with a label (textbox,combobox,datetimepicker), for an advanced search, controls could be more than 100, depends, the big problem is that everything is very slow, it take 5 seconds or more to create it, there is any way to speed up the process ?

I tried with double buffer but nothing change

thank you very much
Beppe_s  Wednesday, September 23, 2009 2:00 PM
Hello, I have some problem with my vb.net interface, I need to add dynamically in a window several controls with a label (textbox,combobox,datetimepicker), for an advanced search, controls could be more than 100, depends, the big problem is that everything is very slow, it take 5 seconds or more to create it, there is any way to speed up the process ?

I tried with double buffer but nothing change

thank you very much
Beppe_s  Wednesday, September 23, 2009 1:58 PM

Maybe an approach like pooling speed up things a bit.

Also if you are showing controls together(ex a label, and a textbox in a row and allways together) you can make them user control or custom control.

Tamer Oz  Wednesday, September 23, 2009 2:19 PM
multi thread? Have multiple threads invoking a method that adds controls?
Omego2K  Wednesday, September 23, 2009 2:58 PM
at moment I use a new thread to populate the window with all the controls, this avoid to freeze the window, but does not help much in performance

I will try with pooling and with something custom control, I also see that the combobox are much slower than the textbox...

There is any way to build this control in some background thread during application start up and clone it every time i need it ?

my application have tabControl so I can open advanced search also in two o more tabs...


Beppe_s  Wednesday, September 23, 2009 3:16 PM
You could always put the control into a DLL and run NGEN on the assembly.

But, I think the real problem is that you could just simply have way too many controls ("over a 100"?), which will only create future problems.
If you need to display a lot of data couldn't something like a custom DataGridView be used?

But, I have seen applications where "custom rows" are defined as custom controls, and then stacked up to give the appearance of a DGV.

Rudedog =8^D

Mark the best replies as answers. "Fooling computers since 1971."
Rudedog2  Wednesday, September 23, 2009 3:26 PM
I agree 100 controls is way too much. Even if it wasn't slow to create, do you expect the user to even find a filter easily with even 30 controls? I suggest you moving away from that design and and having something like a drop down for the user to select what they want to search by, control by control, and then add these controls after the user makes their choice, control by control, choice by choice.

As for loading it in the background, how about having a loading screen instead? Many applications use a splash/loading screen if it takes time to load.
Omego2K  Wednesday, September 23, 2009 3:37 PM
I know it could be strange, but yes there are over 100 controls (with labels)... by the way, I will check all your's advice! Thks a lot
Beppe_s  Wednesday, September 23, 2009 3:38 PM
Hi Beppe,

> for an advanced search, controls could be more than 100

Do you need to read any data from database while form is loading? I think that will affect the loading speed. Since your form is for search purpose. Why not group the functions and make some form for different search requirement?

Sincerely,
Kira Qian
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework!
Kira Qian  Friday, September 25, 2009 8:54 AM

You can use google to search for other answers

Custom Search

More Threads

• Trap ScrollBar Messages from Scroll bar Handle
• Designer problem with tabpages
• Box on a Winform?
• datagrid - combobox - allowing inline update to displaymember
• Detecting objects in other running programs
• Background colour of DataGrid
• Complete uninstall with whole program folder
• Object relational mapping
• Is ToolTip control the right one for content previewing?
• How to insert a ToolStripItem anywhere you want inside a MenuStrip?