Loading Forms at Startup

B

Beebs

Is there any way in VB .NET to load all forms into memory at startup
without showing them, then showing my startup form using ShowDialog.
For all of my forms I'm using the singleton method, so I don't know
whether that would be an issue or not. Would something like this work
for each form:

frmForm1.Instance().Hide()

or would there be some overhead and/or a performance hit on the
handheld? Any suggestions?
 
C

Chris Tacke, eMVP

It's going to be slow if you load them all, but you can. Simply create the
instance for each before Application.Run. You'll have to modify the project
to start in Sub Main

--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate
 
R

Robbe Morris [C# MVP]

I'd suggest not doing this. If you have variables you want
to share across forms, put them in Public Shared / public static properties.

You need to be watchful of how much you load into memory
on these devices. Loading more forms than necessary at any given
time will hurt performance.
 
B

Beebs

Actually, I was inquiring about this not from a variable standpoint,
but rather a performance standpoint while within the application
itself. For certain forms, the first time loading it is just seems to
do so awfully slowly, which is potentially confusing to the user, even
if I put up a wait cursor, thus my thinking on just doing this all
from the start.
 
J

Jeremy

I'm also developing a multi-form application at the moment however I don't
load the forms all at once at the start . "Running" between the forms is
pretty smooth on my iPaq 5550, even though on one of my forms I do some
pretty heavy dynamic(80+ pictureboxes) creation of buttons/pictureboxes
etc.. loading that form takes approx 3-4 seconds. Annoying I guess but I
have a nice little message asking them to be patient.. i supose it doesn't
make it all good but better small waits than a heavy one at the start - i'd
say.
 

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

Top