C# tutorial-2

C# tutorial-2

Hi Guys I hope you all are enjoying new year 2013 and  C# tutorials series on Learn and Earn.Last time we learnt to write and Debug a C# program using notepad and Command Prompt.So if you love to write code on notepad just like java then you are more than welcome to do that but using a IDE certainly gives a lot of functionalities and easyness to make projects.Therefore we will make our first program in C# on Visual Studio 2010.

Let’s Get Started……

First of all Download and Install Visual Studio 2010 From here-2010 Visual Studio and then visit the starting C# tutorial to understand the basic about namespace,class and static function…..

After downloading the visual studio install it on your PC/Laptop and during the first run after installation select the default Programming Language as C# development Settings..

Now start the visual studio (It will take some time to open for the first time )

Select New Project From File and then this window will open up in visual studio to choose the type of project.

Now Choose the type of application you want to make-either windows,web,silverlight,windows phone ,console or cloud application.

As we have already made one console application so let’s make a windows form application….so choose windows form application….


Now you have 3 way look rightmost one is known as Toolbox which contains built in controls to make the application(you can view it from view as well),middle one is the design view/code view for your application and leftmost one is known as solution explorer which contains all files for your application.

Now Every Application has two most important files design file and code behind file on which most of your application is depended….

We will discuss all the files of solution explorer in detail in next tutorials,lets make a small application today….so lets drag and drop one label(which holds a value),one textbox(to take some value from user),and one button to do something

on button click event….


Now set name to toolbox items by right click->properties->text and then double click on button to write the event code for button on Cs file of form….

On click fuction write this code ……



Messagebox.show(“Welcome to My First Windows Application” + Textbox.Text);




Message.show(“enter your name”);


So value/content of textbox1 will be displayed in messagebox…….

Now save it->press f6 to built the solution of your project(similar to compilation) and then press f5 to debug/run the application.

Now enter content in textbox1 and click on showmessage button to see the required message.

Congrats you made your first Windows Form Application keep reading geeksvillage for more such tutorials.

Leave a Reply

Post atricle in AuthorBG.com article minimum 300 words.