Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

C# Console application, getting input without displaying it

$
0
0

I want to receive input of a single char from the user without having the inputted character actually appear on the screen.

Right now I use this:

pick = '0';
pickint = 0;
picked = false;
while (!picked)
{
     pick = Console.ReadKey().KeyChar;
     Console.WriteLine();
     if ((int.TryParse(pick.ToString(), out pickint)) && (pickint > 0 && pickint <= picks))
           picked = true;
}

The result is:

"

__You are in place A___

1. Do this.

2. Do that.

2 (<-- this is the user input)

You do that.

"

I want to do this but without the 2 the user types appearing on screen, how can I do this?


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>