Saturday, January 26, 2013

C# Tutorial-2-Install and Make Program on Visual Studio

[caption id="attachment_1385" align="alignleft" width="260"]C# tutorial-2 C# tutorial-2[/caption]

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

vs2010

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

vs2010-2

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 ……

if(Texbox1.Text!=null)

{

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

}

else

{

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.

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

No comments:

Post a Comment