scott
scott

Reputation: 3081

How can I get the position of the cursor in a console app?

I would like to be able to check that the position of the cursor hasn't moved past a certain point. I haven't been able to find anything that gives the position of the text cursor via google. I'm not really sure where else to look.

Upvotes: 18

Views: 32213

Answers (2)

Cinchoo
Cinchoo

Reputation: 6326

Use Console.CursorLeft and Console.CursorTop

Please look at this MSDN link for more information

http://msdn.microsoft.com/en-us/library/system.console.aspx

Upvotes: 8

Chris Dunaway
Chris Dunaway

Reputation: 11216

Look at the various methods and properties of the Console class. Specifically, using Console.CursorLeft and Console.CursorTop, you can get and set the position of the cursor.

Upvotes: 29

Related Questions