Creating Simple WinForm Application
Creating Simple WinForm Application
Hey there ! This blog post is for the beginners who are just starting to learn programming or building their first application using Visual Studio. So if you are an advanced user/developer this post is not for you.
Now for beginners, following are the steps to create your first WinForm application.
First of all, Launch Visual Studio 2013. Select File⇒ New Project
Next, select Windows Forms Application from the installed template making sure that you are under correct language category. We will be using C#.
As you can see the solution has been created and inside the solution we have a WinForm application is created. The project is pretty much done and you can hit F5 button to see your WinForm application running.
Adding Model Project
Now as per what we discussed in class, we need to create our Model classes into a separate class library. So let's do that next.
Right click on the solution and click Add New Project.
Select the Class Library Project Template.
You can see in the solution explorer, that we have two projects under our solution.
Next, let's add our Model classes in the Model project we just created.
Adding Reference
In order to use our Model project classes in our WinForm application, we will have to add reference of Model project to WinForm project.
Right click on the References Node in your WinForm application and click Add Reference context menu item.
In the window, select Solution and Tick the check box next to the Model Project name, Click Ok.
To make sure the reference was added properly, make sure you see the Model project name into the References list.
Ok, we have a basic WinForm application and a class library project ready to be used. In the next post we will extend our form to accept the input from users and insert that data into a SQL Server database using Ado .Net.