How to write first .net(dotnet) program?

Write first .net(dotnet) program

Are you new to programming. Here i will tell you how to write your first .net program and run into .net framework.

I will tell you my experience, when i started learning .net programming, i did not know even open the .net software. I will say you complete process from opening .net application to run the program successfully.

First of all, i know you are very curious to know how i can write my first program, how to open software, how to create project, how to run, lot of questions might be running in your mind.

I will let you know the complete process. Just Follow the steps one-by-one

First step

If Microsoft.net software installed in your system, there is a icon displaying in your desktop

visual studio.net icon on desktop

 

just double click that icon, Microsoft.net software will begin to open, keep patience, it is very heavy software, keep patience and wait for a moment, do not click anywhere, it will be not responded, when this is completely open, then you start working.

If Microsoft.net icon not displaying in your desktop, just follow this step:
Start > All Programs > Microsoft Visual Studio > Microsoft Visual Studio Icon.

visual studio.net icon on program files

 

 

 

When your softare completely open, it will be look like this.

Microsoft visual studio.net

Now you will have to create a new project, follow this step:

Go to File > New > ProjectNew Project in .net

Now one dialog box will appear look like this

Select the Project type you want to create, there are one default langauge would be displaying, whatever default langauge you selected at the time of installing. You have to select the project type, i will select in Visual C#, window application, When you select the windows, there are more options will display, select one of them, i will select Windows forms Application, now write the name of the project, bydefault name would be displaying i.e WindowsFormsApplication1, you can change it here and then lets go under the name i.e location of the project, by default location is
C:\Documents\Visual Studio 2008\Projects

You can change it also to another location, there is no changes affect the project.

Now, Press ok, your new project has been created look like this:

select the project type in .net

Now analyze your requirement, i will show you the first program to display a message after clicking in the button, ok

Now see, Drag a button from the toolbox, you can change the various properties of the button, now double click the button, a code source page will be displayed, just start coding on button, you want to display a message, you have to write this code on button function:

How to write code
MessageBox.Show(“Hello”);//This will display a message when you click on that button.

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;using System.Windows.Forms;

namespace WindowsFormsApplication1{

public partial class Form1 : Form    {

public Form1()        {

InitializeComponent();        }

private void button1_Click(object sender, EventArgs e)        {

MessageBox.Show(“Hello”);        }    }}

Now you have run this program, simply click F5 button or press green button named Start Debugging(F5).
You program will start running looking like this

how to run the .net program

Just press that button, the see a hello message come.
That’s all
You can see the complete video tutorials here…

* Learn To Write first .net(dotnet) Program

About

Hi, This is R K Gupta, an IT professional and Entrepreneur. I have written many articles yet for my websites gsesoftsolutions.com, Hope you like it. Kindly subscribe our feed for any updates. Add me in Facebook and Google+

Posted in Microsoft .Net Help, Software Development