M
MFRASER
I have a function that I can't seem to get to work properly. This function
is suppose to loop through a collection of controls and locate an existing
ojbect of that type. if it locates the control it uses that object if it
does not a new object is added.
public void SetMainControl(System.Windows.Forms.Control Testcontrol)
{
System.Windows.Forms.Control aTmpControl = TestControl;
bool found = false;
foreach(System.Windows.Forms.Control aControl in
StudyViewer_Fill_Panel.Controls)
{
if (aControl is aTmpControl)
{
found = true;
TestControl = aControl;
break;
}
}
if (!found)
{
StudyViewer_Fill_Panel.Controls.Add(Testcontrol);
}
Testcontrol.Dock = DockStyle.Fill;
}
is suppose to loop through a collection of controls and locate an existing
ojbect of that type. if it locates the control it uses that object if it
does not a new object is added.
public void SetMainControl(System.Windows.Forms.Control Testcontrol)
{
System.Windows.Forms.Control aTmpControl = TestControl;
bool found = false;
foreach(System.Windows.Forms.Control aControl in
StudyViewer_Fill_Panel.Controls)
{
if (aControl is aTmpControl)
{
found = true;
TestControl = aControl;
break;
}
}
if (!found)
{
StudyViewer_Fill_Panel.Controls.Add(Testcontrol);
}
Testcontrol.Dock = DockStyle.Fill;
}