I am currently working on some code with which I am having some trouble.
I have two buttons on a GUI. If one button is pressed it assigns a value to a string a value to reflect this.
The other button is the same except that a different value is assigned to the string.
This String is created at the beginning before the constructor in the following manner:
public string s = "String"; // public so I can call it in another class
The problem comes when I want to find out which button was pressed in another class. I want to see what s
is so I have to create an instance of that class GUI:
gui = new GUI();
This then resets the value of s
to "String" again and this ruins my comparison.
Is there any way I can get around this?
I've tried lots of ideas but nothing seems to work.