Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Console.BufferHeight Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets the height of the buffer area.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public static int BufferHeight { get; set; }
/** @property */
public static int get_BufferHeight ()

/** @property */
public static void set_BufferHeight (int value)

public static function get BufferHeight () : int

public static function set BufferHeight (value : int)

Property Value

The current height, in rows, of the buffer area.

Exception typeCondition

ArgumentOutOfRangeException

The value in a set operation is less than or equal to zero.

-or-

The value in a set operation is greater than or equal to Int16.MaxValue.

-or-

The value in a set operation is less than WindowTop + WindowHeight.

SecurityException

The user does not have permission to perform this action.

IOException

An I/O error occurred.

This example demonstrates the BufferHeight and BufferWidth properties. The example reports the dimensions of an operating system window set to a buffer size of 300 rows and 85 columns.

// This example demonstrates the Console.BufferHeight and 
//                               Console.BufferWidth properties.
using System;

class Sample 
{
    public static void Main() 
    {
    Console.WriteLine("The current buffer height is {0} rows.",
                      Console.BufferHeight);
    Console.WriteLine("The current buffer width is {0} columns.",
                      Console.BufferWidth);
    }
}
/*
This example produces the following results:

The current buffer height is 300 rows.
The current buffer width is 85 columns.
*/

// This example demonstrates the Console.BufferHeight and 
//                               Console.BufferWidth properties.
import System.*;

class Sample
{
    public static void main(String[] args)
    {
        Console.WriteLine("The current buffer height is {0} rows.", 
            System.Convert.ToString(Console.get_BufferHeight()));
        Console.WriteLine("The current buffer width is {0} columns.",
            System.Convert.ToString(Console.get_BufferWidth()));
    } //main
} //Sample
/*
This example produces the following results:

The current buffer height is 300 rows.
The current buffer width is 85 columns.
*/

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft