Sponsored Ad

Friday, April 30, 2010

How to Create a First Console Application in VS 2005 – C#

Sometimes fresher's face much problem in created their first application. We are here to develop a first console application with screen shots using C# of VS 2005.

Lets go though this process step by step:

Step 1: Open VS 2005 and click on File –> New –> Projects

VS 2005

 

Step 2: Select project type as Visual c# and Templates as console Application

Select C# and console application

 

step 3: New Project is  created.

Project is Created

 

Step 4: Lets write few lines of code.

I have written two lines in program.CS file inside the main method. Console.Write is used to print the given line on the screen. Console.ReadLine is used to read line from screen. we are using Console.ReadLine here to stop the output screen until press any key. if you will remove this line the output screen will disappear.

     Console.Write("This is my First Console Application");

     Console.ReadLine();

You can add a extra file in this application also by

Right Click on MyFirstConsoleApp –> Add –> New item –> Select a Type of File and give the name of file and click on ok button.

 

Write line of Code

Step 5: Now lets run the application by pressing F5 button or click the below button.

Run The Application

 

Step 6: Output of above program is here.

Output

 

Source code:

using System;
using System.Collections.Generic;
using System.Text;

namespace MyFirstConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("This is my First Console Application");
            Console.ReadLine();
        }
    }
}

 

 

Congrats you have created first program and run it, Please let us know in case of any problems.

0 comments:

Post a Comment

Sponsored Ad

More Related Articles

Website Update

Followers