Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
TableLayoutPanelGrowStyle Enumeration
Collapse the table of content
Expand the table of content

TableLayoutPanelGrowStyle Enumeration

Specifies how a TableLayoutPanel will gain additional rows or columns after its existing cells are full.

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

public enum TableLayoutPanelGrowStyle

Member nameDescription
AddColumnsThe TableLayoutPanel gains additional columns after it is full.
AddRowsThe TableLayoutPanel gains additional rows after it is full.
FixedSizeThe TableLayoutPanel does not allow additional rows or columns after it is full.

If all the cells in the TableLayoutPanel are filled and the GrowStyle property is set to FixedSize, an attempt to add another control will throw an exception.

The following example shows how to use TableLayoutPanelGrowStyle to set the GrowStyle property on a TableLayoutPanel control. This code example is part of a larger example provided for the TableLayoutPanel control.

    private void growStyleNoneBtn_CheckedChanged(
		System.Object sender, 
		System.EventArgs e)
    {
        this.tlpGrowStyle = TableLayoutPanelGrowStyle.FixedSize;
    }

    private void growStyleAddRowBtn_CheckedChanged(
		System.Object sender, 
		System.EventArgs e)
    {
        this.tlpGrowStyle = TableLayoutPanelGrowStyle.AddRows;
    }

    private void growStyleAddColumnBtn_CheckedChanged(
		System.Object sender, 
		System.EventArgs e)
    {
        this.tlpGrowStyle = TableLayoutPanelGrowStyle.AddColumns;
    }

    private void testGrowStyleBtn_Click(
		System.Object sender, 
		System.EventArgs e)
    {
        this.TableLayoutPanel1.GrowStyle = this.tlpGrowStyle;

        try
        {
            this.TableLayoutPanel1.Controls.Add(new Button());
        }
        catch(ArgumentException ex)
        {
            Trace.WriteLine(ex.Message);
        }
    }

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft