Solved

Initialize All forms in a VB.NET application at Startup

Posted on 2007-03-28
3
261 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now