First of all, I don't think your forms are related as a child and a parent. Even though the class
System.Windows.Forms.Form
has the properties
System.Windows.Forms.Control.Controls
and
System.Windows.Forms.Control.Parent
, the
parent-child relationship between forms is not really operational.
(More exactly, if you try to make one form a parent of another, an exception will be thrown. You can avoid it by assigning the property TopLevel = false
for a child form and make another form its parent, but the result is ugly: one form sitting inside the client area of another form as a control. You should never do it. I do not mean the relationship between MDI parent and MDI children; they are not actually the parent-child relationships between forms. Besides, who need MDI.)Now, about the access to the button between forms. It's not good to provide the access immediately to the control, as it would violate class encapsulation. This is the popular question about form collaboration. The most robust solution is implementation of an appropriate interface in form class and passing the interface reference instead of reference to a "whole instance" of a Form. Please see my past solution for more detail:
How to copy all the items between listboxes in two forms[
^].
—SA