0

I have 3 forms. When I click on the "admin" on the first form, I open the second form, where I enter the password. If it is correct, then the third form opens, where I can change the variables used in the first form. The problem is that I do not know how to link the third form and the first, so that the values of the variables change. I need that when changing the variables in the third form, their values are taken in priority over the values specified in the code to the first form. How can I do that?

int rent = 5, coldwater = 20, gas = 30, electricity = 40, hotwater = 50, heating = 60, phone = 70, tv = 80, net = 90;

These are my variables specified in the code to the first form

Alex Do
  • 11
  • 3

1 Answers1

0

You "link" the forms by keeping a reference to the other forms, in the form from which the change is triggered. Then you can either directly change the value of the specific controls, or create some public methods on the form you want to change that can be used to pass the updated data and trigger the change to the control(s). You should check the link to the possible duplicate posted by elvin.

Malte R
  • 468
  • 5
  • 16