On Wed, 11 Jul 2007 00:20:01 -0700, einat
<ei***@discussions.microsoft.comwrote:
I have a form in c# with handreds of controls. It's take alot of time to
th
program to start what can i do?
Fewer controls?
Seriously, that's a lot of controls.
It's hard to provide very good advice without knowing the specifics. How
are the controls arranged? Why do you have so many? Are they all visible
at once? What kinds of controls are they?
But for the most part, the solution will still be some form of "fewer
controls". Whether that's using the same controls but more intelligently,
or revising the UI so that instead of using controls, you use some sort of
custom drawn UI that's a single custom control, or at least some smaller
number of custom controls, the general goal would be to reduce the number
of controls.
Of course, there is also the question of what "a lot of time" means (some
people don't like waiting even a second or two, while others are happy if
their application starts up in under 30 seconds...subjective terms like "a
lot of" don't convey the reality very well), as well as what exactly the
controls are doing in their initialization (hundreds of controls is a lot
of controls, but you should also make sure that you aren't doing something
especially expensive during initialization that would slow things down).
Again, you should provide better specifics if you want a really good
answer. You may even want to post a concise-but-complete example of code
that demonstrates what your form looks like, how the controls are used,
and how slow it is to start the program.
Pete