Friday, 6 September 2013

Using FormName.Show() in a .NET application

Using FormName.Show() in a .NET application

In a .NET application (VB is being used in this case), what is the proper
way to open a form?
Dim f1 as new Form1()
f1.Show()
or
Form1.Show()
I have inherited a codebase that is nearly 100% the latter.
What exactly is happening here? From what I understand, this should be an
error considering Form1 is never initialized with a new. Does .NET
automatically instantiate an object for all of your forms?
What are the issues that can be caused by this, specifically memory issues?
Is it bad practice to use Forms like this?

No comments:

Post a Comment