Click here to Skip to main content
15,896,402 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two forms and one Class

First Form is frmMain and MDIParent set to true. Second Form is frmClientInfo. Class is clsAction

On frmMain I have a menu button, when click calls clsAction.

I have to load frmClientInfo into FrmMain from clsAction. At the same time see if frmClientInfo is already Loaded, if so just activate it, else show frmClientInfo

I know how to do this in VB.NET..just can my head around it in C#

Thx
Posted
Updated 1-Dec-09 9:09am
v3

1 solution

wrote:
I have to load frmClientInfo into FrmMain from clsAction.


If you have to do this, you need references of frmClientInfo and FrmMain into clsAction class. Once you have references in the class, you can always set the MDIParent property on frmClientInfo.

To answer the second part, you can get list of all child forms from a MDI form. In that you can loop through the collection and check whether the type of the desired form is not equal to the one which is part of the loop. If the loop executes and you find that none of the forms match the desired form type, you are free to create a new instance of the desired form and display it. If you find that one of the forms has the type as that of the desired form, you just activate it and break the loop.

Hope you understood.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900