Hi.
i am trying to learn c# I have newly installed Visual studio dot net 2005. i typed the following program but not getting ouptut
i did file->new->file->visual c#

i tried the following code

// Namespace Declaration
using System;

// Program start class
class InteractiveWelcome 
{

	// Main begins program execution.
	static void Main() 
	{

		// Write to console/get input
		Console.Write("What is your name?: ");
//		Console.Write("Hello, {0}! ", Console.ReadLine());

		string name = Console.ReadLine();
		Console.Write("Hello, {0}! ", name);
		Console.WriteLine("Welcome to the C# Station Tutorial!"); 

		// keep screen from going away
		//	when run from VS.NET
		Console.ReadLine();

	}
}

when i press f5 it just refreshes and goes back to the same screen

Recommended Answers

All 6 Replies

Hi.
i am trying to learn c# I have newly installed Visual studio dot net 2005. i typed the following program but not getting ouptut
i did file->new->file->visual c#

i tried the following code

// Namespace Declaration
using System;

// Program start class
class InteractiveWelcome 
{

	// Main begins program execution.
	static void Main() 
	{

		// Write to console/get input
		Console.Write("What is your name?: ");
//		Console.Write("Hello, {0}! ", Console.ReadLine());

		string name = Console.ReadLine();
		Console.Write("Hello, {0}! ", name);
		Console.WriteLine("Welcome to the C# Station Tutorial!"); 

		// keep screen from going away
		//	when run from VS.NET
		Console.ReadLine();

	}
}

when i press f5 it just refreshes and goes back to the same screen

Well you are using class, not project, thats why u got this problem...
Well just go like this: File-->new-->project
and then a window will appear, there u see a form, double click on that form and do the coding behind that.
and remember one thing u cant write the console code in visual studio, it wont work here..........
Hope it will help you........:)

mark this thread as solved if this help you........

and remember one thing u cant write the console code in visual studio, it wont work here..........QUOTE]

It will if you select "Console Application" from the New Project screen :) try this.

dear aviraj,

i am getting errors. I clicked file-new-project windows and double clicked on the form

it gave me a run time error(application5.exe does not exist) as well

thanks dude it worked

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.