I have two Forms in a project.
When my application runs, Form1 is opened. After that I am opening Form2.
How can I access Form1 from Form2 with reflection?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Why would you want to use reflection for this?
When you create the second form, just pass in a reference to the first one:
That’s assuming you’re happy to add a constructor with
Form2as a parameter. Alternatively, make it a property inForm2: