Question Show form2

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
520
Programming Experience
3-5
why do this?

VB.NET:
dim frm2 as form2
frm2 = new form2
frm2.show()

why not just

VB.NET:
form2.show()
 
Using the default form instance is useful if you only need to operate with one instance of that form at the same time, since you don't have to create the instance and keep the reference and it's available globally. The default instance is a dynamic reference, if you showed one and it was closed a shiny new one is returned next time you call it.
 
Back
Top