c# - How to add controls into a new tab page which is dynamically created? -
i developing windows form application in c# has tab control dynamically created tab pages. want add same layout , controls (comboboxes, textboxes, buttons & datagridview) comboset item 1
newly created tab page (comboset item 2
in case). how can , how name controls?
new tabs generated 1,2,3... n
. 'n' number of datagridviews added under new tabs. there way bind these datagridviews , possible so?
any appreciated!
create new user control->place controls user control->create properties controls. have manage user control.
void addtab() { tabpage tbp = new tabpage(); tbp.name=tabcontrol1.tabpages.count.tostring(); myusercontrol cnt = new myusercontrol(); cnt.name="cnt" + tbp.name; cnt.dock=dockstyle.fill; tbp.controls.add(cnt); }
if cannot place code user control can create events each control. example productname_selectedvaluechange productname combobox, validating discount value , handle addtab() method.
Comments
Post a Comment