This documentation is archived and is not being maintained.

TableLayoutPanel.ColumnCount Property

Gets or sets the number of columns in the table.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

public int ColumnCount { get; set; }
/** @property */
public int get_ColumnCount ()

/** @property */
public void set_ColumnCount (int value)

public function get ColumnCount () : int

public function set ColumnCount (value : int)

Not applicable.

Property Value

The number of columns in the TableLayoutPanel control. The default is 0.

You can specify both the ColumnCount and the RowCount properties for layouts with a known and fixed number of cells. You can also specify one property or the other if you expect the number of cells in your layout to grow, assuming that the GrowStyle property allows for such growth. If the value of RowCount is 0, the panel will grow by adding rows, and if the value of ColumnCount is 0, the panel will grow by adding columns. Specifying panel growth with the GrowStyle property is preferred to setting RowCount or ColumnCount to 0, however.

Controls can be added or deleted from the table using the Controls property.

Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0