Right now I'm making a GUI for several different controllers I've made. Each controller is in its own class and is a WPF. In order to use the controller, I need an IP address that the user types into a text box that the GUI contains. When I create an object of my GUI class and try to use the variable, it is whatever I initialize the variable as, rather than the updated variable.
The variable is updated in my GUI class. Not in my other classes.
I am very new to C#, help!
public partial class MainWindow : Window {
public String nao_ip = "";
private void IPAddress_TextChanged(object sender, TextChangedEventArgs e)
{
nao_ip = IPAddress.Text;
}
}
public partial class Test : Window
{
MainWindow main = new MainWindow();
public Test()
{
InitializeComponent();
}
public void Window_Loaded(object sender, RoutedEventArgs e)
{
String nao_ip = main.nao_ip;
MessageBox.Show(nao_ip);
}
}
They are in two separate .xaml files.