when i create a control by drag and drop VS automatically generate code like this:
public System.Windows.Forms.Label label1;
When i want to change modifier of that control to Static, i go to Form1.Designer.cs and edit to:
public static System.Windows.Forms.Label label1;
It's ok. But when i modify every control, VS automatically change it to origin :(. So how do you change modify of a control to static ?
sorry, im bad at English :(
code from a comment:
public static void setLabelInfoVisible(bool visible)
{
if (Form1.labelInfo.InvokeRequired)
{
setLabelInfoVisibleDelegate del =
new setLabelInfoVisibleDelegate(setLabelInfoVisible);
Form1.labelInfo.Invoke(del, new object[] { visible });
}
else
{
Form1.labelInfo.Visible = visible;
}
}
It seems that your actual problem is another one: Updating controls from another thread. This should NOT be accomplished by static controls!
These related questions should solve your problem: