Can I evaluate two groups of items with a foreach loop in C# winforms? -
i have winforms tabcontrol , trying cycle through controls contained in each tab. there way add and
in foreach
loop or isn't possible evaluate more 1 group of items? example i'd do:
foreach (control c in tb_invoices.controls , tb_statements.controls) { //do }
or
foreach (control c in tb_invoices.controls, tb_statements.controls) { //do }
is possible, , if not, next best thing? need use for
loop?
foreach(tabpage page in yourtabcontrol.tabpages){ foreach(control c in page.controls){ loopthroughcontrols(c); } } private void loopthroughcontrols(control parent){ foreach(control c in parent.controls) loopthroughcontrols(c); }
Comments
Post a Comment