I have a tableLayoutPanel inside which i have added Panels dynamically— the name of Panels are :
Panel1 ,
Panel2
.
.
.
.
.
.
.
.
.
.
.
Panel10
Now , in these dynamically added Panels , am adding some more controls dynamically such as :
In Panel1 : LabelDate1, LabelTime1, LabelPicAdder1, LinkLabel1
In Panel2 : LabelDate2, LabelTime2, LabelPicAdder2, LinkLabel2……
Now , on a button click, i want to change the values of the controls inside the Panel1, Panel2,
but if i do this :
foreach ( Control ctrl in this.tableLayoutPanel )
, i am ONLY able to get the Panels into ctrl variable,
but how to get the controls inside these Panels into some variable and change the TEXT property of those controls…..
I mean, how do i get the controls which are inside the Panels, which are themselves inside the tableLayoutPanel
TableLayoutPanel—->Dynamic Panels———–>Dynamic Controls –how to change the text property of this last object in the hierarchy
You added the control to the panels. So you have to iterate each panel:
Odds are good that you can simplify your code by storing the control references when you create them instead of trying to find them back later.