Hide/Show rows in TableLayoutPanel in C#


  • how to hide or show rows in tablelayoutpanel.

    tried by setting height of the row as zero but still i can see some portion of row.

     tableLayoutPanel1.RowStyles[1].Height = 0;

    i want to know how to Remove a row from tablelayout panel too.even this solves my problem

    Monday, March 19, 2012 11:49 AM

All replies

  • Hi .NET Learner Suni,

    To remove a row from TableLayoutPanel, you need to
           tableLayoutPanel1.RowCount = tableLayoutPanel1.RowCount - 1;
           tableLayoutPanel1.RowStyles.RemoveAt(tableLayoutPanel1.RowStyles.Count - 1);
    vice versa, to add rows at run time, do it like this:
    for (int j = 0; j < 10; j ++)
            new RowStyle(System.Windows.Forms.SizeType.Absolute, DEFAULT_HEIGHT));

    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, March 20, 2012 8:23 AM