1

In VB.NET, I can have multiple forms and show one from the another by using the following code:

Form2.Show() ' Form2 is the class name itself!! not an instance..

How it that allowed?

Youssef13
  • 3,836
  • 3
  • 24
  • 41

1 Answers1

0

Your project uses a Forms object in a namespace called My. In there, Visual Basic creates default instances of the forms:

https://learn.microsoft.com/en-us/dotnet/visual-basic/developing-apps/development-with-my/default-object-instances-provided-by-my-forms-and-my-webservices

This seems to be happening somewhere behind the scenes. I have not been able to locate a file in my project where this is happening, but I see My.Forms being used in my executable.

Thorsten Kettner
  • 89,309
  • 7
  • 49
  • 73