c# - Removing a specific Row in TableLayoutPanel -


I have TableLayoutPanel that I add rows to the program. The user is basically stole a property and then displayed in the table with some controls. I think I have a general understanding problem here and I will try to explain it.

Each control has a 'Delete' button in each row. This button should delete the row I have inserted in. What I did is add an eventholder to the button and sets the current line number.

  deleteTalent.Click + = (Sender, E) => ButtonClickHandler (numberOfRows);   

Code of handler:

  Private Zero button click the handler (int punctiquity) {int count = rowCount - 1; For (int i = count; i <(count + 5); i ++) {balance tab Control. Remove (count); } BalanceTableRostile Indent (count); BalanceTable.RowCount--; }   

I watched it for hours and played around. But I did not get a clean cleaning solution I also makes C # I am very new to

A new line that is complete function here:

  private void addBalanceItems (ToolStripMenuItem item) {int numberOfRows = balanceTable .RowCount; If (numofofo> gt; 1) {sansable.roastile.ed (new system .indo.org.formstyle (system.indo.form.syaz type autosize)); } BalanceTable.Height = numberOfRows * 45; Steigergearchnerchner Rancher = New Steregorzsner (); String tag = item.Tag.ToString (); // asap :( If (tag == "A") {rechner.column = 1;} if (tag == "b") {rechner.column = 2;} change (tag == "c") { Rechner.column = 3;} if (tag == "D") {rechner.column = 4;} if (tag == "e") {rechner.column = 5;} if (tag == "F") {rechner.column = 6;} if (tag == "G") {rechner.column = 7;} if (tag == "H") {rechner.column = 8;} label talentName = new label (); talentName.Text = item.Text; talentName.Height = standardHeight; talentName.TextAlign = ContentAlignment.MiddleLeft; talentName.AutoSize = true labels cost = new label (); cost.TextChanged + = (sender, e) = & gt; costChangeHandler (costs); cost.Height = standardHeight; cost.TextAlign = ContentAlignment.MiddleLeft; text box startValue = new textBox (); startValue.TextChanged + = (Q Annual, e) = & gt; startValueChangeHandler (Rechner, startValue, cost); startValue .Height = standardHeight; startValue.TextAlign = HorizontalAlignment.Center; text box endValue = new TextBox (); endValue.TextChanged + = (sender, e ) = & Gt; endValueChangeHandler (Rechner, and Value, Cost); EndValue.Height = standardHeight; EndValue.TextAlign = horizontal alignment. center; Button deleteTalent = new button (); DeleteTalent.Text = "x"; DeleteTalent.Click + = (Sender, E) = & gt; ButtonClickHandler (numberOfRows); DeleteTalent.Height = standardHeight; BalanceTable.Controls.Add (talentName); BalanceTable.Controls.Add (startValue); BalanceTable.Controls.Add (endValue); BalanceTable.Controls.Add (cost); BalanceTable.Controls.Add (deleteTalent); BalanceTable.Visible = true; BalanceTable.RowCount ++; }   

Any help would be appreciated!

"itemprop =" text ">

Yes, remove an arbitrary line from a TableLayoutPanel not at all Intuitive they have actually spoiled the design on this.

The only way to remove the rows is to establish the property; it is lonely alone; That property is sure that it should be read-only and code, which every time I see it, I find it wrong.

But beyond this, the result of this design is that you are in the middle. Resetting the property can alter rows from bottom to bottom.

The solution is a bit of a burden, with several steps that are incorrectly obtained:

  1. Remove the control of the line you want to delete < Li> If applicable, then move those controls to another line.
  2. After all the controls that come in all the other rows come line, you want to delete a line.
  3. Finally, remove the last line by reducing the value of the property RowCount .

    A quick Google search shows that someone is saying to do this. It is in VB.NET, but it should be in your native language.

    I believe that I am just known for the pants and setting the line RowHight want to "extract" from I 0. In this way, autosaving works for you that you still want to remove that control, though.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -