D
D
djEban2019-05-16 14:44:40
C++ / C#
djEban, 2019-05-16 14:44:40

C#. How to save information between Windows Forms?

Good afternoon.
I have a main menu which has an "advanced" button. When this button is pressed, another window appears, and the Enabled parameter of the main window becomes false.
Question: how to set the Enabled main window to true when clicking on "Cancel" and close the additional one 5cdd4ce6c602c951589065.png5cdd4cebda166381681557.png?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Peter, 2019-05-16
@djEban

There are a lot of options:
1. Pass a link to an instance of the class of the main window of the form, through the constructor when creating another window.
2. Pass a delegate to the function, also through the constructor
3. Create an event in the dependent window class and subscribe to it after creation.
etc.

V
Vladimir Korotenko, 2019-05-25
@firedragon

https://docs.microsoft.com/en-us/dotnet/api/system...
Open a new form through a dialog. After closing, you will have the result.
In addition, use the Global object with states, and in forms, only change its properties.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question