Remove row from tablelayoutpanel
-
Hey all I have a TableLayoutPanel on a form, this form is inherited a number of times by others. This works fine but some of these forms do not need all the rows that are on the default table. I can't see any way of removing a particular row from the layout (ie row 3) on the new forms load. Can this actually be done at run time? It just seems wrong if you can't... Thanks in advance.
-
Hey all I have a TableLayoutPanel on a form, this form is inherited a number of times by others. This works fine but some of these forms do not need all the rows that are on the default table. I can't see any way of removing a particular row from the layout (ie row 3) on the new forms load. Can this actually be done at run time? It just seems wrong if you can't... Thanks in advance.
found this solution on the Scripts, by Losweg
Hi,
I was struggling with the same problem today.
In the first column of my TableLayoutPanel, I'm showing a checkbox.
When the user is checking it, a new row needs to be created.
When the user is unchecking it, the row containing the checkbox should be
removed.Logically to remove a row in the TableLayoutPanel, I would think to do
something like this:
tableLayoutPanel.RowStyles.RemoveAt(index);But I found out this is not enough.
You need to clear the controls for that given row as well!
tableLayoutPanel.Controls.RemoveAt(...);
tableLayoutPanel.Controls.RemoveAt(...);Once the controls in the Controls-collection are gone, the Event that
redraws your tableLayoutPanel doesn't draw them again.Hopes this is working for you as well...
Visual Studio can't evaluate this, can you?
public object moo { __get { return moo; } __set { moo = value; } }
-
found this solution on the Scripts, by Losweg
Hi,
I was struggling with the same problem today.
In the first column of my TableLayoutPanel, I'm showing a checkbox.
When the user is checking it, a new row needs to be created.
When the user is unchecking it, the row containing the checkbox should be
removed.Logically to remove a row in the TableLayoutPanel, I would think to do
something like this:
tableLayoutPanel.RowStyles.RemoveAt(index);But I found out this is not enough.
You need to clear the controls for that given row as well!
tableLayoutPanel.Controls.RemoveAt(...);
tableLayoutPanel.Controls.RemoveAt(...);Once the controls in the Controls-collection are gone, the Event that
redraws your tableLayoutPanel doesn't draw them again.Hopes this is working for you as well...
Visual Studio can't evaluate this, can you?
public object moo { __get { return moo; } __set { moo = value; } }