Dynamic button,Text and picturebox creation in c# -


here doing 1 project . questions present in images. when project loads , "start exam " button present in screen. after pressed button , should create picturebox, textbox , button each image specified path. users have enter answer in textbox created dynamically . after dynamic submit button clicked every image, textbox values have store in listbox. dont know how values textbox. can me out .

here coding :

picturebox[] pics = new picturebox[100]; textbox[] txts = new textbox[100]; button[] butns = new button[100]; flowlayoutpanel[] flws = new flowlayoutpanel[100];  private void button1_click( object sender , eventargs e) {         (int = 0; < listbox1.items.count; i++)         {             flws[i] = new flowlayoutpanel();             flws[i].name = "flw" + i;             flws[i].location = new point(3,brh);             flws[i].size = new size(317,122);             flws[i].backcolor = color.darkcyan;             flws[i].borderstyle = borderstyle.fixed3d;             pics[i] = new picturebox();             pics[i].location = new point(953, 95 + brh);             pics[i].name = "pic" + i;             pics[i].size = new size(300, 75);             pics[i].imagelocation = "c:/" + listbox1.items[i];             flws[i].controls.add(pics[i]);              txts[i] = new textbox();             txts[i].name = "txt" + i;             txts[i].location = new point(953, 186 + brh);              flws[i].controls.add(txts[i]);             butns[i] = new button();             butns[i].click += new eventhandler(butns_click);             butns[i].text = "submit";             butns[i].name = "but" + i;             butns[i].location = new point(1100, 186 + brh);              flws[i].controls.add(butns[i]);             flowlayoutpanel1.controls.add(flws[i]);             brh += 130;            }      } private void butns_click(object sender, eventargs e) {     button butns = sender button;     textbox txts = sender textbox;      listbox2.items.add("text values " + txts.text.tostring()); } 

i create usercontrol combine controls.

search "custom usercontrol c#"

regards.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -