Console.BufferWidth Property

Gets or sets the width of the buffer area.

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

'Declaration
Public Shared Property BufferWidth As Integer

Property Value

Type: System.Int32
The current width, in columns, of the buffer area.

ExceptionCondition
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 WindowLeft + WindowWidth.

SecurityException

The user does not have permission to perform this action.

IOException

An I/O error occurred.

If a set operation decreases the value of the BufferWidth property, the rightmost columns are removed. For example, if the number of columns is reduced from 80 to 60, columns 60 through 79 of each row are removed.

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. 
Imports System

Class Sample
   Public Shared Sub Main()
      Console.WriteLine("The current buffer height is {0} rows.", _
                        Console.BufferHeight)
      Console.WriteLine("The current buffer width is {0} columns.", _
                        Console.BufferWidth)
   End Sub 'Main
End Class 'Sample

'This example produces the following results: 

'The current buffer height is 300 rows. 
'The current buffer width is 85 columns. 
'

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft