System.Console.SetCursorPosition Method

Sets the position of the cursor.

Syntax

public static void SetCursorPosition (int left, int top)

Parameters

left
The column position of the cursor. Columns are numbered from left to right starting at 0.
top
The row position of the cursor. Rows are numbered from top to bottom starting at 0.

Remarks

Use the Console.SetCursorPosition(int, int) method to specify where the next write operation in the console window is to begin. If the specified cursor position is outside the area that is currently visible in the console window, the window origin changes automatically to make the cursor visible.

The cursor automatically moves to the next character position each time a character is written to the console window. If the cursor is at the bottom right character position of the console window, the next write operation causes the console window to scroll so the cursor remains visible. If you want to write a character to the bottom right character position without causing the console window to scroll, use the erload:System.Console.MoveBufferArea method to move a character to that position.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0