Click here to Skip to main content
15,909,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a c# application and there are a lot of forms with controls.
and every time when i run my application, forms which have many controls open slow.
so is there any way to make it open faster?
Posted

There are many possible solutions.

1. Is all loading you do necessary and can the loops, SQL queries, database itself (indexes) be optimized. This is the very first thing you need to do.

2. In FormLoad, use SuspendLayout and ResumeLayout to stop reloading controls on each change, but rather on a transaction of changes. (Please read up on the methods before using)

3. If it is still slow, can you wait loading controls until needed, eg. A combobox with 10 000 items will always be rather slow. What if you changed that combobox to a usercontrol with a textbox and button that opens a small dialog with the list. (of course, already filtered with the value typed in the textbox) That would postpone loading the data until you actually press that button.

4. Using NGen compilation can improve performance, but I would not use it until a last resort.

Of course there a re other things to consider: Is the network fast enough, is the hardware fast enough, do you have sufficient memory? In case of network issues, caching data might help, for hardware issues: just upgrade.

Hope this helps.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 27-Feb-12 3:41am    
I voted 4. Those are very good reasonable consideration, but I would rather demand more information from the OP. It could be some simple performance leak, due to trivial and usual general design mistake.
--SA
Try using NGEN on your assemblies : http://msdn.microsoft.com/en-us/magazine/cc163610.aspx[^]

You can also try hiding your forms instead of closing and recreating them.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900