Name of main form in app

  • Thread starter Thread starter Paul Aspinall
  • Start date Start date
P

Paul Aspinall

Hi
I have an app which consists of several forms, some of which are hosted as
MDI in the main form, which is the MDI parent.

The initial 'main' form in the app is instanced via
[STAThread]

static void Main()

{

Application.Run(new frmMain());

}



I want to access some of the public properties and methods in the main form
(type of frmMain).



My question is....

How do I access the public properties and methods of the main form, as it is
instanced as 'new frmMain()', and doesn't have an object reference



Any help appreciated



Thanks
 
I am not sure I understand your correctly. But all forms can have properties
just as any other object can. Are you trying to set properties of a form
that is loaded in the MDI from another child form? Please clarify a little
more.
 
Simply add a field of type frmMain and in Main assign new frmMain() to
that field and pass it to Application.Run.

class FrmMain
{
FrmMain instance;

static void Main()
{
instance = new FrmMain();
Application.Run(frmMain);
}
}

Regards
Senthil
 
Back
Top