Name of main form in app

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
 
G

Guest

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.
 
S

sadhu

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top