out of memory in c# display

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
Hello einat,

It's a tough question and there is no direct dependency on the number of
control
I recomend examine this document http://msdn2.microsoft.com/en-us/library/ms998583.aspx
to understand what do u need to apply to improve startup time - either using
the ngen (simpliest way) or changing the application, introducing lazy intitialization
and all other stuff

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

e> I have a form in c# with handreds of controls. It's take alot of time
e> to th program to start what can i do?
e>
 
Hi,

einat said:
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?

Less controls?

Frankly I have never see a form with more than 100 controls, what it looks
like?
(post a picture)

There are a couple of things you could do, you can use a Splash screen until
the form is created or even shown in the screen (you close the Splash from
the Form_Load handler)

Also you could try to create some laziness , create the controls when
needed, like the first time that a tabpage is activated, etc
 
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?

100 controls? My! What does the form do? Is it necessary to have all
the controls on the form?

If they are all necessary then you might want to look at ways to
minimize them -- for instance using a calendar instead of 3 combo
boxes, etc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top