PERSONA PERSONA - 1 year ago 72
C# Question

Prevent the console from overwrting a line

Is there a way for me to stop the console from printing to the top line?
So :

this line in the console doesn't change

but this one and the ones under it can

Any help would be greatly appreciated. Thanks.

Answer Source

I think if you want leave the first line alone without overwrite it, you can use Console.SetCursorPosition.


// Set cursor starting from the second line
Console.SetCursorPosition(0, 1);
Console.WriteLine("The second line");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download