views:

105

answers:

1

I need a way to show multiple lines of text (e.g. 1000 lines) in a console application, and be able to scroll through all lines. However, when I do something like the code snippet below, I can only see the last 100 or so lines in the console.

for (int i = 1; i <= 1000; i++)
{
   Console.WriteLine(i.ToString());
}

My initial though was to show a chuck of lines (e.g. 100 at a time), and let the user hit to browse further, but I've hoped there was an easier - and more userfriendly way?

+4  A: 

If you want more control over the amount of lines which are scrollable in the Console, you can adjust the Console.BufferHeight property to be much larger. The value is the number of rows which are displayed. So if you set it to the number of lines, and assuming none of them wrap, your output will be scrollable.

JaredPar