winforms - How to add label dynamically in tab control in C#? -
i trying output results have been found out label in tab control. not display them @ all. please take @ code , tell me did wrong ? thank you.
private void btnsearch_click(object sender, eventargs e) { int indexresult = 0; string title, id; double price; string = txtsearch.text; if (xbox360.havegame(a, ref indexresult)) { title = xbox360.gettitle()[indexresult]; results.settitle(title); id = xbox360.getid()[indexresult]; results.setid(id); price = xbox360.getprice()[indexresult]; results.setprice(price); } if (ps3.havegame(a, ref indexresult)) { title = ps3.gettitle()[indexresult]; results.settitle(title); id = ps3.getid()[indexresult]; results.setid(id); price = ps3.getprice()[indexresult]; results.setprice(price); } if (wii.havegame(a, ref indexresult)) { title = wii.gettitle()[indexresult]; results.settitle(title); id = wii.getid()[indexresult]; results.setid(id); price = wii.getprice()[indexresult]; results.setprice(price); } // going output result array results, however, // here want output sample string (int = 0; < 3; i++) { label resultlabel = new label(); resultlabel.location = new point(10, 7); resultlabel.text = "output here"; this.controls.add(resultlabel); } }
you should consider use heritage wii, ps3 , xbox class, can do:
foreach (generictype console in consolelist) { if (console.havegame(a, ref indexresult)) { title = console.gettitle()[indexresult]; results.settitle(title); id = console.getid()[indexresult]; results.setid(id); price = console.getprice()[indexresult]; results.setprice(price); } }
Comments
Post a Comment