M
MFRASER
How do I loop through a collection of controls testing to see if a certain
control type already exists in the collection.
//this doesn't work
foreach(System.Windows.Forms.Control aControl in
StudyViewer_Fill_Panel.Controls)
{
if (typeof(aControl) == typeof(TestControl))
{
tmpControl = TestControl;
aControl.Show();
}
else
{
aControl.Hide();
}
}
control type already exists in the collection.
//this doesn't work
foreach(System.Windows.Forms.Control aControl in
StudyViewer_Fill_Panel.Controls)
{
if (typeof(aControl) == typeof(TestControl))
{
tmpControl = TestControl;
aControl.Show();
}
else
{
aControl.Hide();
}
}