Mask input

G

Guest

I’m trying to do a console application and would like to limit the number of
characters entered, I’m using the Console.ReadLine(). Can’t you do something
like this Console.ReadLine(“#####â€)?
 
P

Peter Duniho

Gus said:
I’m trying to do a console application and would like to limit the number of
characters entered, I’m using the Console.ReadLine(). Can’t you do something
like this Console.ReadLine(“#####”)?

Not without writing your own code, no.

You will have to use Console.ReadKey() to handle the input directly.
This includes handling the backspace key explicitly yourself if you want
the user to be able to go backwards in the input.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top