where are my childcontrols in the childcontrol??
I am trying to programmatically generate a form where I in design time have put a flowpanel in the form and in this flowpanel, depending on user input, generate several controls of my own(UserControl1 containing 2 textboxes, 2labels). Now the problem is that I cant reach the textboxes and labels to programmatically update nor get data from them. I am trying to use
a generic list where I in a loop store initiated usercontrol1. I add them to the flowLayoutPanel:
//for loop
UserControl1 tmpUC = new UserControl1();
fcList.Add(tmpUC);
this.flowLayoutPanel1.Controls.Add(tmpUC);
//end loop
The flowLayoutPanel is then added to the form control:
this.Controls.Add(flowLayoutPanel1);
Then the problem appears...I cant get to the childcontrols of the UserControl1, through iterating the List.
foreach(UserControl1 uc in fcList){
uc.GetNextControl(textBox2, true);
}
Following error: The textBox2 does not exist in the current context.
My goal: I want to be able to generate a form with my own usercontrol. This usercontrol contains 5 controls. How can I reach those controls to update them??
I am stuck for days with this problem....please help!
(please tell if my problemspecification is poor)
Thank you
platinumrx
|