Click here to Skip to main content
15,922,894 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I need help in how to determine an active MDIChild objec from other class which is not linked with niether Parent nor Child?

I have tried with below code, but pParent is return as NULL.

C#
 MDIParent pParent = MDIParent.ActiveForm as MDIParent;
if (pParent == null) return;
MDIChild pChild = pParent.ActiveMdiChild as MDIChild;


I need help in knowing where I am going wrong here as I am new to C#.

Thanks for the help.
Posted
Updated 1-Feb-12 23:43pm
v2
Comments
Slacker007 2-Feb-12 5:43am    
Edits made: formatting.
sheetal.gawde 3-Feb-12 3:11am    
I am also having the same problem...kindly let me know the solution.
Thanks in Advance.

1 solution

This will have the answer you looking for.
Get Active MDI Child form at winform app[^]

Please remember to mark my answer as well as vote for it if it helps solve your problem.

Regards,
 
Share this answer
 
v2
Comments
nhasmita 2-Feb-12 23:28pm    
Thanks for answer, but as i mentioned in my question, i am having one class which is not linked to Child or Parent form.

Inside that class, i want to access some functions of MDIChild, which are created by me, so i am unable to get object of currently Active MDIChild.

Hoping to get answer for this scenario...

Thank U

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