Group Box

  • Thread starter Thread starter Madhavi
  • Start date Start date
M

Madhavi

I Dynamically generate Controls on a groupBox

but i have to Enable a button when the dyanmic controls generated are
checked

so i loop them

foreach(System.Windows.Forms.Control temp6 in Controls)
{
kkkkkkk
enableButton = true;
}


But the problem here is Controls does not contain the names of the
dynamic Controls that were genareated on the groupBox . It traverses
thrugh group box and Buttons available on the form.

If i write another loop within as follows
foreach(System.Windows.Forms.GroupBox transtemp7 in groupBox )
an error occurs stating the
Error 1 foreach statement cannot operate on variables of type
'System.Windows.Forms.GroupBox' because 'System.Windows.Forms.GroupBox'
does not contain a public definition for 'GetEnumerator'

Can somebody help me how to traverse controls in a group Box
 
Add the Controls to the Controls Collection of the GroupBox. Not only does
this enable you to loop through the Collection, but enables you to Dispose
of each Control if and when it is removed.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.
 
Back
Top