Click to See Complete Forum and Search --> : Accessing MDIChild methods or events
scoobweb
February 25th, 2005, 05:46 PM
Hello, i'm just starting to use c#, and my question is how to use a public method from an MDIChild created at runtime. I am trying to have access from a toolbar button in the MDIMain. if i create a new object of the mdiChild from the toolbar, i do have access to that method, but that doesn't work because it's another instance of the object, and if i use this:
Form childWin = this.ActiveMdiChild;
childWin.MyPublicMethod(...) //this doesn't show up
How can i have access to the active mdiChild window method?
checksal
February 25th, 2005, 05:50 PM
You do not need to instantiate an opbject if you just want to access the method. Create a static method and you can access it like this:
Form.MyPublicMethod(...);
instead of like this:
Form childWin = this.ActiveMdiChild;
childWin.MyPublicMethod(...);
scoobweb
February 25th, 2005, 07:20 PM
thx a lot that works great, but another conflict aroused :-) oops, at some point i need to use a SaveFileDialog, and it seems i cant access any of the controls in the mdiChild , how about that? Spefically the name ofthe SaveFileDialog which in this is the one of interest.
checksal
March 1st, 2005, 03:11 PM
Can you please post some code relating to your situation because it would help if the gurus could see the issue. Thanks.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.