arrays - How to show label or textbox made by coding in c# -
arrays - How to show label or textbox made by coding in c# -
let me explain how programme :
1.i have textbox1 user input number 2.i have button1,where store number textbox1 int max
here's coding
private void button1_click(object sender, eventargs e) { max = int.parse(textbox1.text); fun = new textbox[max]; (int = 0; < max; i++) { if (i > 0) { y = y + 26; } fun[i] = new textbox(); fun[i].location = new system.drawing.point(44, y); fun[i].text = "test"; } }
now problem won't appear @ all,because don't know code create appear on form itself.
if understand correctly want dynamically create controls , display in form? looks code okay, need add together controls form display in form. code may help you.
int y = 26; var max = int.parse(textbox1.text); var fun = new textbox[max]; (int = 0; < max; i++) { if (i > 0) { y += 26; } fun[i] = new textbox(); fun[i].location = new system.drawing.point(44, y); fun[i].text = "test"; controls.add(fun[i]); }
c# arrays textbox
Comments
Post a Comment