private void btnaddrow_Click(object sender, EventArgs e) { tableLayoutPanel1.GrowStyle = TableLayoutPanelGrowStyle.AddRows; tableLayoutPanel1.AutoSize = true; int InsertRowNum = tableLayoutPanel1.RowCount; tableLayoutPanel1.AutoScroll = true; tableLayoutPanel1.Visible = true; RowStyle newRowStyle = new RowStyle(); newRowStyle.SizeType = SizeType.Absolute; newRowStyle.Height = 30; tableLayoutPanel1.RowStyles.Insert(InsertRowNum, newRowStyle); tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(SizeType.Absolute, 30)); // Add controls to the new row for (int row = 0; row < tableLayoutPanel1.RowCount; row++) { for (int column = 0; column < tableLayoutPanel1.ColumnCount; column++) { TextBox textBox = new TextBox(); textBox.Text = string.Format("TextBox({0}, {1}) ", column, row); tableLayoutPanel1.Controls.Add(textBox, column, row); } } tableLayoutPanel1.TabIndex++; tableLayoutPanel1.Visible = true; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)