Creating Simple WinForm Application

Jan 30, 2015
Facebook Twitter Google Digg Reddit LinkedIn Pinterest StumbleUpon Email


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

    Basic WinForm Application

  • Next, select Windows Forms Application from the installed template making sure that you are under correct language category. We will be using C#.

    Basic WinForm Application

    Basic WinForm Application

  • 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.

    Basic WinForm Application

  • Select the Class Library Project Template.

    Basic WinForm Application

    You can see in the solution explorer, that we have two projects under our solution.

    Basic WinForm Application

  • Next, let's add our Model classes in the Model project we just created.

    Basic WinForm Application

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.

    Basic WinForm Application

  • In the window, select Solution and Tick the check box next to the Model Project name, Click Ok.

    Basic WinForm Application

  • To make sure the reference was added properly, make sure you see the Model project name into the References list.

Basic WinForm Application

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.