This documentation is archived and is not being maintained.

Console.WindowWidth Property

Gets or sets the width of the console window.

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

static member WindowWidth : int with get, set

Property Value

Type: System.Int32
The width of the console window measured in columns.


The value of the WindowWidth property or the value of the WindowHeight property is less than or equal to 0.


The value of the WindowHeight property plus the value of the WindowTop property is greater than or equal to Int16.MaxValue.


The value of the WindowWidth property or the value of the WindowHeight property is greater than the largest possible window width or height for the current screen resolution and console font.


Error reading or writing information.

This example demonstrates the SetWindowSize method, and the WindowWidth and WindowHeight properties. You must run the example to see the full effect of changing the console window size.

The example reports the dimensions of a console window set to 85 columns and 43 rows, then waits for a key press. When any key is pressed, the dimensions of the console window are halved, the new dimensions are reported, and the example waits for another key press. Finally, when any key is pressed the console window is restored to its original dimensions and the example terminates.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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