0
How to hide user input after entered?
So basically what I'm trying to do is have the console read whatever the person says, but after they type it and hit enter, have it be removed. For example: String name; Console.WriteLine("What is your name?"); Name = Console.ReadLine(); Console.WriteLine("Hi {0}.", name); The console would look like: What is your name? Anvy Hi Anvy. What I'm trying to do is remove the second line, Anvy and have the next one be "Hi Anvy". I know there is Console.Clear() but that clears the whole console. What can I do?
3 odpowiedzi
+ 2
Maybe if you can positioned cursor at the same line at the beginning and overwrite
+ 2
or if you can do some kind of input in "silent mode"
+ 1
Maybe this sees a tricky way:
Console.WriteLine("What is your name?");
ConsoleColor color=Console.ForegroundColor;
Console.ForegroundColor=Console.BackgroundColor;
string name = Console.ReadLine();
Console.ForegroundColor=color;
Console.WriteLine("Hi {0}.", name);