Have you tried accessing the Controls property?
var controls = dockRounds.Controls;
Have you tried accessing the Controls property?
var controls = dockRounds.Controls;
There are several strategies you can use to achieve communication/linkage between objects on different Forms. Note : My reply here is not going to address any issues specifically related to DockPanelSuite, and is not going to consider the difference between the "secondary" forms being "independent" (i.e., they are not "owned" by the MainForm) or being made child Forms of the MainForm. This is a conscious choice made on the basis of believing that what you are asking about is independent of those possible variations in implementation.
In Form2 define a property like :
public Button form2Button
{
get { return button1; }
}
Now in the Load event of your Main Form, assuming that's where an instance of Form2 is created, you can subscribe to the Click event of the Button on Form2 :
Form2 myForm2;
Form3 myForm3;
private void Form1_Load(object sender, EventArgs e)
{
myForm2 = new Form2();
myForm2.form2Button.Click += new EventHandler(form2Button_Click);
myForm3 = new Form3();
}
And you can easily imagine that in Form3 you have a TextBox that you have exposed with a Public Property in the same way you exposed the Button on Form2.
So you can implement the MainForm's event handler like this for the Button click on Form2 :
public void form2Button_Click(object sender, EventArgs e)
{
// do something here with the TextBox on Form3
// myForm3.theTextBox.Text =
}
... other strategies ...
in your secondary form, for example, a button press can raise a Public Event which the Main Form (or any other entity to which Form2 is exposed) could subscribe to and then dispatch the appropriate whatever to the appropriate target.
you can abstract message-passing in general at a higher level into a single (perhaps static) class where publishers send messages, and the messages are dispatched to registered listeners.
Finally, the discussion here may be of interest to you :
best,
Your classes, dockRounds and dockToolbox should expose any properties/events that you want to access. So if you want to hook up to a control's event, route it to a public event.