Windows Phone Developers

Showing posts with label Wait for user input in C# Console Application. Show all posts
Showing posts with label Wait for user input in C# Console Application. Show all posts

Saturday, April 14, 2012

How to change Text Color of Console (.NET/C#)

Configuring C# Console Application Title and Text Color


Console application should also look nice. There are ways to do it.

First - have a good title .. most often I have seen the Application Path etc as the title

The following snippet provides a way to customize the title of Console Application and also the TextColor

Console.Title = "Course Ware Example";
            System.Console.WriteLine("What you did on Red Letter Day");
            Console.ForegroundColor = ConsoleColor.Red ;
            string s1 = Console.ReadLine();


Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Wednesday, October 22, 2008

C# Console Application – Pause for User Input / Pause Command in C# Console Application

In some cases you may require to pause for the user input or display a message to the user and prompt him to continue by pressing the key.

ReadKey does the trick. It obtains the next character or function key pressed by the user.

Console.WriteLine("Press any key to continue...");

Console.ReadKey(true);

If you want the key to be displayed on user window, you can set the parameter to be false. You can also get the pressed key using as ConsoleKeyInfo shown below

Console.WriteLine("Press any key to continue...");

System.ConsoleKeyInfo KInfo = Console.ReadKey(true);

Console.WriteLine("You have pressed :" + KInfo.Key.ToString());

Press any key to continue in C#, C# Console Application Wait, Wait for user input in C# Console Application, C# Console Application, C# ConsoleKeyInfo, C# KeyPress in Console Application

Press any key to continue in .NET, .NET Console Application Wait, Wait for user input in .NET Console Application, .NET Console Application



C# Console Application Wait Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon