Static Method containing a Main form control
Posted on 2009-12-22
I have a public static method that I am calling from a different class to make an adjustment to my main window gui. In order for the other class to be able to use it I made it static. But then I got an error saying that the form control that I am updating needs to be static. How can I get around this to be able to update an existing control on my main gui?
code that is part of my window1 class that refers to my status bar in my WPF front end.
static public void status_bar_msg(string msg)
TextBlock statusLabel = new TextBlock();
statusLabel.Text = msg;
code that is in a class outside of my Window1 class that attempts to make a change to the front end.
Window1.status_bar_msg("Excel Export took " + Math.Round(diff.TotalSeconds, 2).ToString() + " secs.");