We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

can child access parent without instancing?

I have a main form which has several child forms. One of child forms is a form with help (helpForm). I am trying to add a code which would allow any child to open a form with helpForm when user presses F1. The problem is how to access a function in mainform from child without instancing, as when I instance a mainform in child form, then I ahve a problem with determining is helpForm open or not. Also is there a way of accessing a variable declared in main form from child forms without instancing main form?

1 Reply

GR grer June 30, 2003 05:04 PM UTC

IS this an MDI application or and SDI? If mdi then you can access the parent with midparent property. and just cast it to the main form. If SDI, then you can use reflection ot call the main form using methodinvoke. > I have a main form which has several child forms. One of child forms is a form with help (helpForm). > I am trying to add a code which would allow any child to open a form with helpForm when user presses F1. > The problem is how to access a function in mainform from child without instancing, as when I instance a mainform in child form, then I ahve a problem with determining is helpForm open or not. > Also is there a way of accessing a variable declared in main form from child forms without instancing main form? >

Loader.
Live Chat Icon For mobile
Up arrow icon