Fairly new to WinForms. I have a main form (Main) that contains a SplitContainer (container) with two panels (Panel1 and Panel2)
In container.Panel1, I have a combobox (selectFY), and a button. Clicking the button loads a second form in container.Panel2 like:
private void btnButton1_Click(object sender, EventArgs e)
{
container.Panel2.Controls.Clear();
Form2 form = new Form2();
form.TopLevel = false;
form.Dock = DockStyle.Fill;
container.Panel2.Controls.Add(form);
form.Show();
}
What I am trying to do is from within the code of Form2, read the selectedText value from the selectFY combobox in container.Panel1
I have tried:
Accessing as
Main.container.Panel1.selectFY.selectedTextCreating a link to Main like
Main mainform = new Main(); var fy = mainform.container.Panel1.selectFY.selectedText
But neither has worked.