In this article i will tell you how to close Form on click of the button using C#.Net.
In the Previous articles i explained how to update record into access database using vb.net, how to delete record from access database using vb.net, how to add namespace in vb.net, redirect to page according to role while login in asp.net, how to open form on click of the button using c#.net and many more about C#.Net.
Add Form to your project and Name it as "Form1.cs".
Add another form and name is as "Form2.cs".
Open Form1 and Drag and Drop Button Control on Form1.
Here what we will do is on clicking on the button we will close form 2.
Double click on Button control.
Write the below code there on click event of the button.
Form2 op = new Form2();
Created object of Form2 and use Close() method to Close Form2.
If you want to close current Form. You can use following code.