Click here to Skip to main content
15,920,633 members
Home / Discussions / C#
   

C#

 
GeneralRe: Which function is like "getch()" in Console App? Pin
Febret11-Nov-05 2:40
Febret11-Nov-05 2:40 
GeneralRe: Which function is like "getch()" in Console App? Pin
Lane Yu11-Nov-05 3:35
Lane Yu11-Nov-05 3:35 
GeneralRe: Which function is like "getch()" in Console App? Pin
J4amieC11-Nov-05 4:14
J4amieC11-Nov-05 4:14 
GeneralRe: Which function is like "getch()" in Console App? Pin
Febret11-Nov-05 4:18
Febret11-Nov-05 4:18 
GeneralRe: Which function is like "getch()" in Console App? Pin
Lane Yu11-Nov-05 4:27
Lane Yu11-Nov-05 4:27 
GeneralRe: Which function is like getch() in Console App? Pin
Rob Philpott11-Nov-05 5:15
Rob Philpott11-Nov-05 5:15 
GeneralRe: Which function is like getch() in Console App? Pin
Lane Yu11-Nov-05 5:48
Lane Yu11-Nov-05 5:48 
GeneralRe: Which function is like "getch()" in Console App? Pin
Febret11-Nov-05 6:05
Febret11-Nov-05 6:05 
I see: if you want to read a single character from the user (any charachter, not an enter key press), and you don't want that character to be shown, the only way to do it on .Net 1.0 /1.1 (the 2.0 Console.ReadKey does the same thing) is to import _getch from msvcrt.dll.

You can use this code (by reinux from http://www.codeproject.com/useritems/PressAnyKeyToContinue.asp):

[DllImport("msvcrt.dll")]
private static extern int _getch();

public static int Getch()
{
	try
	{
		return _getch();
	}
	catch
	{
		return Console.Read();
	}
}


Insert this into a class and then you should be able to use Getch() to do what you need.

Bye!
QuestionDirectoryEntry.Properties["memberOf"] Pin
Chris_Green11-Nov-05 0:58
Chris_Green11-Nov-05 0:58 
QuestionShould you put config files in the GAC with assemblies? Pin
pliu_200011-Nov-05 0:52
pliu_200011-Nov-05 0:52 
AnswerRe: Should you put config files in the GAC with assemblies? Pin
S. Senthil Kumar11-Nov-05 2:58
S. Senthil Kumar11-Nov-05 2:58 
GeneralRe: Should you put config files in the GAC with assemblies? Pin
pliu_200011-Nov-05 3:09
pliu_200011-Nov-05 3:09 
QuestionIME and Language Bar Pin
jonny511-Nov-05 0:05
jonny511-Nov-05 0:05 
QuestionHow to use parameter for oracle? Pin
rushing10-Nov-05 22:14
rushing10-Nov-05 22:14 
QuestionCheck if a file is used by an other process Pin
holgerl10-Nov-05 22:13
holgerl10-Nov-05 22:13 
AnswerRe: Check if a file is used by an other process Pin
jonny511-Nov-05 0:13
jonny511-Nov-05 0:13 
QuestionValidation Pin
vuthaianh10-Nov-05 22:10
vuthaianh10-Nov-05 22:10 
QuestionDecrypting data Pin
Prashant Gadhave10-Nov-05 21:38
Prashant Gadhave10-Nov-05 21:38 
AnswerRe: Decrypting data Pin
leppie11-Nov-05 0:26
leppie11-Nov-05 0:26 
QuestionWindows service using Com dll Pin
Ankit Aneja10-Nov-05 21:15
Ankit Aneja10-Nov-05 21:15 
AnswerRe: Windows service using Com dll Pin
jonny511-Nov-05 0:16
jonny511-Nov-05 0:16 
GeneralRe: Windows service using Com dll Pin
Ankit Aneja11-Nov-05 0:37
Ankit Aneja11-Nov-05 0:37 
Question(Yet Another) Dockable Window/Form Question Pin
TheBlindWatchmaker10-Nov-05 21:15
TheBlindWatchmaker10-Nov-05 21:15 
AnswerRe: (Yet Another) Dockable Window/Form Question Pin
Robert Rohde11-Nov-05 7:00
Robert Rohde11-Nov-05 7:00 
QuestionArea Partition of irregualr polygon in C# Pin
satish090910-Nov-05 20:24
satish090910-Nov-05 20:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.