Dear all,
I hope I'm not about to poperly fall at the final fence - hopefully someone can point me in the right direction...I have a flow layout panel into which I'm putting many instances of a user control. This control (for now) just has a check box and a few text fields only.
The code in the user control form looks like:
public partial class myfrmList : UserControl
{
public int Index
{
get { return int.Parse(lb_Ref.Text); }
set { lb_Ref.Text = value.ToString(); }
}
public CheckState Displayed
{
get { return cb_show.CheckState; }
set { cb_show.CheckState = value; }
}
...etc you get the idea...
}
In the code for my main form, when I want to put a new instance of the user control into the flow layout panel, I can do this with...
myflowlayoutpanel.Controls.Add(new myfrmList
{
Displayed = CheckBoxState,
Index = Indexval
});
...and the flow layout panel is populated with a new instance of my user control with the values I've set in it.
My problem is I can't find the right syntax to be able to use the 'get' routines to return values from each instance of the user control. I can iterate through the controls inside the flow control panel..e.g....
for (ctr = 0; ctr < myflowlayoutpanel.Controls.Count; ctr++)
{
foreach (Control c in myflowlayoutpanel.Controls[ctr].Controls)
{
c....
}
}
but if I do that it looks like all I can do is get the collection of controls in the user control - not their values.
I hope I'm just missing something obvious....if so I'm sorry for bothering you...
Many Thanks,
Aero