views:

27

answers:

1

C# Winforms:

My tableLayout has only one column but it has three rows. I want to be able to show/hide the rows. I did a google search and found this, it works perfect for Hiding the row But what to do for showing it again? setting the height to a hard coded number? Not a good idea ...

    tableLayoutPanel1.RowStyles[0].SizeType = SizeType.Absolute;
    tableLayoutPanel1.RowStyles[0].Height = 0;

what do you propose to accomplish this?

+1  A: 

I would argue that you should set the .Visible property for each control you want to show/hide. Presumably at least one row and column are set to 100% (they absorb the extra space) - that row/column will resize when those controls are no longer visible. Hope that helps.

Robert Seder
is there a way I can say "for each contorl in tableLayoutPanel1.RowStyles[0] " ?
BDotA
Will this tablelayout truly be dynamic? If so, I believe your only other option is to loop through the tableLayoutPanel1.Controls collection. But I would argue it would be clearer if you explicitly did a show/hide on specific controls like customerGroupBox, okButton, etc. Hope that helps
Robert Seder