Reputation: 899
So I have the folowing code for a form.
Public Class tab
Public personas, formaciones, avisos, cursos As List(Of Object)
[Lots of Code]
End class
On another form I want the formaciones
List, so I can just:
ListBox1.DataSource = tab.formaciones
And it works, perfectly.
But.. How?
tab
is a class, not an instance of it, but vb is able to understand that I want the instance of that class.
What happen if there are mor than one tab
open? How does it work internally?
Upvotes: 0
Views: 47
Reputation: 6172
This is part of a default application framework that is enabled when creating VB.NET WinForms applications.
Its intent was to help the migration from VB6 so it creates singletons of each form.
If you want different instances, you can disable/ignore the framework and write your own start up methods.
More details:
Singleton forms: https://msdn.microsoft.com/en-us/library/ms233839.aspx
Enable/disable: https://msdn.microsoft.com/en-us/library/17k74w0c(v=vs.100).aspx
Full article: https://visualstudiomagazine.com/articles/2007/10/01/enable-the-application-framework-in-vb.aspx
Upvotes: 1