From MSDN
foreach-statement:
foreach ( type identifier in expression ) embedded-statement
Form2 frm2 = new Form2;
foreach(frm2 in this.MdiChildren) {
frm2.UpdateControls_BackColor();
}
private const int iMaxForm2 = 5;
private Form2[] frmForm2 = new Form2[iMaxForm2];
private static int iCurForm2 = -1;
if(iCurForm2+1 < iMaxForm2){
iCurForm2 += 1;
frmForm2[iCurForm2] = new Form2();
frmForm2[iCurForm2].MdiParent = this;
frmForm2[iCurForm2].Show();
}
DirectCast(Me.MDIParent, Form1).MyMethod(Me)