There is UserControl uc1 and uc2, both are inside the other control. It is necessary to reproduce uc2.Enabled = true; while the controls to each other are "brothers" with a common "parent".

Note: No delegates and events desirable.

  • And why no events? They are the basic part of the language, and far from the most difficult. And how do you learn about state changes without events? (In WPF for similar purposes there is Binding , probably, there are analogues under WinForms.) - VladD
  • Because I program as much as it is difficult for me to understand them. A comrade tried to explain events and delegates to me, but something is not working. My code is very expensive and is built on global variables and functions that run the necessary processes and for the result that I want to get this is more than enough. - Kodek
  • “It’s not a shame to be a teapot , a shame not to want to get out of this state” (c) a series of books for teapots - VladD
  • I want to get out of this state, but there are always two sides of the coin. And at the moment, to assimilate new methods and complicate the code is worse for me than to write clear and simple code. And then, when the finished product will work, it will be possible to engage in its improvement. - Kodek
  • The truth is that the advanced functionality of the language is needed to significantly simplify the code and facilitate its writing process. I would advise you not to take time and invest in your own knowledge: it will pay off very quickly. - VladD

1 answer 1

The problem was solved as follows, if delegates and events are not used. A class was created, where individual global variables were entered under the necessary controls, which were to be accessed from the share controls.

 class C { public static uc1 ucc1; public static uc2 ucc2; public static uc3 ucc3; } 

Then in the necessary controls records were created in these variables.

  public uc1() { InitializeComponent(); C.ucc1 = this; } 

After that, this control can be accessed from anywhere by C.ucc1 .