I'm trying to get all Controls in a form.
If it is a specific type of Control, I need to convert it to that type so I can change some properties.
thanks in advanced.
here is the code:
public class Enable_Disable
{
public void ChangeProperties(Form myform)
{
foreach (Control c in myform.Controls)
{
if (c.GetType()==System.Windows.Forms.MenuStrip)
{
// I have the error Message at this Line
System.Windows.Forms.MenuStrip m = c;
}
else
c.Enabled = false;
}
}
}
If it is a specific type of Control, I need to convert it to that type so I can change some properties.
thanks in advanced.
here is the code:
public class Enable_Disable
{
public void ChangeProperties(Form myform)
{
foreach (Control c in myform.Controls)
{
if (c.GetType()==System.Windows.Forms.MenuStrip)
{
// I have the error Message at this Line
System.Windows.Forms.MenuStrip m = c;
}
else
c.Enabled = false;
}
}
}