2

I'm a bit confused on exactly how the architecture for a VB.NET forms app actually works.

I've noticed in others' code, lines that read a little like this:

If frmMain.someBooleanProperty Then

but, I'm a bit confused because someBooleanProperty is then defined as an instance variable (i.e., as Public someBooleanProperty As Boolean in frmMain). How is it being referenced statically to access an instance variable? Is this just bad coding practice?

Joseph Nields
  • 5,527
  • 2
  • 32
  • 48

1 Answers1

0

For reasons of backwards compatibility, VB.NET automatically creates an instance of every Form. This instance is accessible through a global property which has the same name as the Form class itself.

More details can be found here:

Community
  • 1
  • 1
Heinzi
  • 167,459
  • 57
  • 363
  • 519