What is advantage in creating New Form?

Hello all,
This is part of one of the Web Examples and wanted to know what the advantage is in creating an instance, rather than the form itself?

Dim main As New MainPage


The advantage is that you are creating the instances and not the framework. Let’s say you have 50 WebPages in your project. When a new session is created, all 50 pages are created at that same time. If you turn off implicit instance and create them yourself, they only take up ram if you actually need them.

Hi Greg.
I did not realize that it created all pages on start. I thought they only were created when they were refernced! For so many other reasons - I agree with you!

Does it work the same in desktop and console apps too? Or just Web?

Thanks for the info Greg!

i can’t seem to find the option to turn off implict instance on Web Edition.

It’s in the same place as Desktop

Since implicit instance is on by default we’ve fixed a lot of issues over the years simply by turning it off and see where the original developers (sometimes us) was trying to access a window when they should not have been. The compiler is really good at helping you diagnose this.

That’s the first time I’ve ever heard this. This is REALLY good to know.