How to open new form on click of the button using C#.Net - C#.Net Sample Source Code

 

Introduction

In this article i will tell you how to open new Form on click of the button using C# .net.

History

In the Previous articles i explained how to insert record into access database using vb.nethow to update record into access database using vb.nethow to delete record from access database using vb.nethow to add namespace in vb.net, redirect to page according to role while login in asp.net and many more about C#.Net.

Step 1.

Add Form to your project and Name it as "Form1.cs".

Step 2.

Add another form and name is as "Form2.cs".

Step 3.

Open Form1 and Drag and Drop Button Control on Form1.

Here what we will do is on clicking on the button we will open form 2.

Step 4.

Double click on button control.

Step 5.

Write the below code there on click event of the button.

Form2 op = new Form2();
op.Show();

Explanation.

Created object of Form2 and use show method to Display Form2.

Give your Valuable Comments.
comments powered by Disqus
 
Follow me on twitter
About Me
Harpreet Singh
I began programming with C++ when i was 17. Then at the middle of my study .NET came. Then I began to read C# and VB.NET. By the time i learnt SQL and ASP.NET, and developed some websites such as news portals that are active now. Currently i am running my own Software company.
More Articles