c# - Add Row Dynamically in TableLayoutPanel -


enter image description here

i want add these entries dynamically row row in tablelayoutpanel in windows form in c#

how can that?

try below code,

// tablelayoutpanel initialization tablelayoutpanel panel = new tablelayoutpanel(); panel.columncount = 3; panel.rowcount = 1; panel.columnstyles.add(new columnstyle(sizetype.percent, 40f)); panel.columnstyles.add(new columnstyle(sizetype.percent, 30f)); panel.columnstyles.add(new columnstyle(sizetype.percent, 30f)); panel.rowstyles.add(new rowstyle(sizetype.absolute, 50f)); panel.controls.add(new label() { text = "address" }, 1, 0); panel.controls.add(new label() { text = "contact no" }, 2, 0); panel.controls.add(new label() { text = "email id" }, 3, 0);  // add new row (loop code add multiple rows) panel.rowcount = panel.rowcount + 1; panel.rowstyles.add(new rowstyle(sizetype.absolute, 50f)); panel.controls.add(new label() { text = "street, city, state" }, 1, panel.rowcount-1); panel.controls.add(new label() { text = "888888888888" }, 2, panel.rowcount-1); panel.controls.add(new label() { text = "xxxxxxx@gmail.com" }, 3, panel.rowcount-1); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -