I am having trouble updating the text in a C# form textbox from outside the
class. Calling function ChangeDisplay from inside the class ControlPanel
works fine, but when I call it from the main program, it doesn't update. I
have declared the variable in another class called global vars, which
several other classes are using.
namespace ControlPanel
{
public class Form1 : System.Windows.Forms.Form
private System.Windows.Forms.TextBox cp_screen;
private System.ComponentModel.Container components = null;
public string keypadinput = "";
public Form1()
{
InitializeComponent();
}
public void ChangeDisplay(string x) // Set display to the passed string
{
cp_screen.Text= x;
}
------------Class Declaration------------------------------
namespace globalvars
{
public class variables
{
public static Form1 Controlpannel = new Form1(); // Start a new instance of
the control pannel class
public static Controller MainController = new Controller(); // Initialize
the main system controller
}
}
Thanks,
Kevin Bowser