For Each ctlarray As Control.ControlCollection _
In New Control.ControlCollection() _
{ Form1.Controls _
, Form1.tabPage1.Controls _
, Form2.TabPage2.Controls _
}
For Each ctl As Control _
In ctlarray
' Do stuff
Next
Next
KW
---------- original post ----------
From: "Phill W." <p-.-a-.-w-a-...@o-p-e-n-.-a-c-.-u-k>
Date: Oct 4 2006, 10:36 am
Subject: for each on multiple collections
To: microsoft.public.dotnet.languages.vb
KW wrote:
Is there a way to do a "foreach" on multiple control collections?
Something like the following which obviously doesn't work:
foreachctl as control in form1.controls, form1.tabpage1.controls, form2.tabpage2.controlsNot directly, but you can loop through an /array/ of collections, then
next
through the Controls ineach, as in :
<AirCode()_
For Each e1 As ControlCollection _
In New ControlCollection() _
{ Form1.Controls _
, Form1.tabPage1.Controls _
, Form2.TabPage2.Controls _
}
For Each e2 As Control _
In e1.Controls
' Do stuff
Next
Next
HTH,
Phill W.