Public variables must be created in the receiving form, such as:
In Form1:
public Color col;
then this variable can be called and written to.
The form(s) also need a definitive reference to one another. Not to
just the class such as Form1.xxx, but to the specific instance of the
form in question, such as:
In Form1:
Form2 myKid = new Form2;
myKid.myDad = this;
myKid.Show();
In Form2:
public Form1 myDad;
then you can write code in Form2 such as:
myDad.col = Color.FromARGB(206, 206, 244);
This code is not tested and is informational, but should be enough to
get you going.
Bob
Mateusz Rajca wrote:
Hello,
I have Form1 - the main form with some controls including a button.
I have Form2 - the properties form with a combobox and button. The user can
select the colors of a button in the combobox in Form2 and press "OK". What
code should I add to "OK" so that the user can change the colors of a button
in Form1?
Mateusz