Answer the question
In order to leave comments, you need to log in
C# WinForms. How to pass a value through a button from one form to another?
I have a form in which, depending on the button pressed, something must be passed to another form in order for it to start using the received value, how to do this?
Answer the question
In order to leave comments, you need to log in
There are hundreds of ways to do this. Okay, not hundreds, but dozens. Here are a few:
1. Passing through the constructor
2. Class methods
3. Class variables
4. Callback
5. Just manipulate the form before opening
About the 5th in more detail:
The form object (form) can be created automatically (as the main form), or it can be created dynamically .
Are you creating the window dynamically? If so, then creating a window may not cause it to appear on the screen soon.
Those. creating a window is one thing, but showing a window is another. In total, you create a window, set the necessary values for controls, variables, properties, etc., and then display the window.
Either way, you have very little knowledge. I recommend reading and looking at examples. Better yet, understand the basics of WinForm.
You need to understand that the form class is a regular class and you can do whatever you want with it, whenever you want.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question