Solved

Initialize All forms in a VB.NET application at Startup

Posted on 2007-03-28
3
276 Views
Last Modified: 2013-11-27
I am developing a program in Visual Studio 2005. There will be more than 50 forms. I was wondering if it a good idea to initialize all forms in a module and define a Sub Main and show the first form.
For example
in Module InitializeForms
Public frmMain1 as new frmMain
.....etc

Sub Main
frmMain.showdialog
end Main
End Module

Any suggestions/ideas would be greatly appreciated.
0
Comment
Question by:vamshi25
3 Comments
 
LVL 14

Accepted Solution

by:
shahprabal earned 25 total points
ID: 18810363
Initializing the forms upfront will take up a lot of memory and possibly increase the start time... even though you have 50 forms if only one or two are going to be up at one time then it (how many forms the application has) wont make any difference if you initialize the forms as needed cause you are only initializing one or two forms at a time.

HTH
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 25 total points
ID: 18810865
It would just be a waste of memory.  .Net is already a memory hog...why give it more stuff to load?

I agree with shahprabal...there is rarely ever a time when you need to "preload" 50 forms...the user can't deal with that many at once.  =)
0
 

Author Comment

by:vamshi25
ID: 18810967
Thank you shahprabal and Idle_Mind for prompt reponses and explaining the memory wastage part.
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question