Providing a Reference to an Application’s Main Form
The sample below assumes that MainForm is the class name of the application’s main form. In the project settings Sub Main has to be selected as startup object:
You can access the main form from everywhere in the application by typing Program.MainForm.
— or —
Alternatively, the Singleton design pattern can be implemented for forms to enable access via their class names: