Hi All,
Depending on used UserControls I need to calculate height of my Groupbox.
How can I count amount of UserControles I used in my Form?
thanx to all
How To Count UserControls
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Aug 16, 2013, 10:23 AM EDT
int count = 0;
foreach (Control c in groupBox1.Controls)
{
if (c is UserControl) count++;
}
MessageBox.Show("There are " + count + " user controls");
ilhami caliskan79 reputationPosted Aug 16, 2013, 10:28 AM EDT