winforms - C# "Extra Space" added to Dynamic Added panel -
i have c# windows form has splitcontainer. inside splitcontainer2 have panel (panel1). within panel creating 10 smaller panels 5 textboxes apiece. add each of these panels panel1.
for (int = 1; < 11; i++) { panel panel = new panel(); textbox txtbox1 = new textbox(); textbox txtbox2 = new textbox(); textbox txtbox3 = new textbox(); textbox txtbox4 = new textbox(); textbox txtbox5 = new textbox(); splitcontainer2.panel1.controls.add(panel); panel.controls.add(txtbox1); panel.controls.add(txtbox2); panel.controls.add(txtbox3); panel.controls.add(txtbox4); panel.controls.add(txtbox5); } in essence i'm trying create table 10 rows , 5 columns. i've tried tablelayoutpanel, couldn't figure out, workaround.
i want provide ability allow user hit button "add new row" , dynamically create new panel 5 new textboxes gets added eleventh row in "table". user can keep adding new "rows" many want.
within panel1 have property set autoscroll when many "rows" added scrolls automatically. reason when "row" below scollable panel space added , keeps getting added every new "row" thereafter.

questions:
1. if use tablelayoutpanel same thing happen?
2. causing "extra space" added?
edit
these following responses same mine, i'm not having luck applying solution.
adding controls panel works first couple of times, fritzes out
you may need add new controls same panel added
var penel = splitcontainer2.panel1.controls.oftype<panel>().firstordefault(); if(penel !=null) penel.controls.add(yournewtextbox);
Comments
Post a Comment