How to reference two forms with each other in C#

This C# Example in Windows Form Application Program shows how to reference form2 in other form1. This C# tutorial is easy to Understand. Referencing in C# programming. How to show form1 on clicking on button on form2 using referencing.

Objective :

How to make two forms reference each other in C#?


Coding on Form1:

We have to create an object form form2 on form1’s initializing event.

Coding on Form2:

In form2 we are making form1 its parent form so it will be referenced in form2.


Hence, when we start the app, form2 will be shown with two buttons. On button2 click event, the form1 will be visible & clicking on Button2 will hide form1.