I have a textBox that I with help of a Button turning to a Gray BackColor like this.
textBox1->BackColor = Color::Gray;
Under this textBox I have a checkBox. (with default "checked").
What I am trying to do here is that when I "uncheck" this checkBox, the textBox will turn "Red" like this:
textBox1->BackColor = Color::Red;
The problem and what I want to do is that when I "check" the checkBox again, I want the textBox1 to turn to the color that from the beginning was in the textBox wich in this case was "Gray".
So I wonder if it is possible to use a code that saves the color in the textBox to a String^ before the textBox1 turns "Red" like below:
Though I know that I probably cant save the current color in the textBox to a String^.
Why I want to save the color before "unchecking" the checkBox is that when checking it again, I have saved that color in this case "Gray" somewhere to use when I "check" the checkBox again to set the color that was from the beginning.
Is it possible to save the BackColor in anyway, to a
String^ or something else ?
String^ SaveCurrentColor = textBox1->BackColor; //This is not correct textBox1->BackColor = Color::Red;
Edited by mike_2000_17: Fixed formatting