c# - Refresh user control instance inside a panel when a button is clicked -
i have these codes in mainform
when click on picturebox
, user control
loads in panel.
my problem datagridviews
inside other controls doesn't updated. when make transactions in other user controls
affects other user controls
.
what want automatically update gridviews
refreshing user control
when associated button
clicked
.
private void picturebox5_click(object sender, eventargs e) { panel2.controls.add(uccustomer.instance); uccustomer.instance.dock = dockstyle.fill; uccustomer.instance.bringtofront(); lblmenu.text = "customer management"; } private void picturebox2_click(object sender, eventargs e) { panel2.controls.add(ucdelivery.instance); ucdelivery.instance.dock = dockstyle.fill; ucdelivery.instance.bringtofront(); lblmenu.text = "delivery management"; } private void picturebox3_click(object sender, eventargs e) { panel2.controls.add(ucreport.instance); ucreport.instance.dock = dockstyle.fill; ucreport.instance.bringtofront(); lblmenu.text = "reports"; }
here's example on how declared instance user control. in same format other user controls.
private static uccustomer _instance; public static uccustomer instance { { if (_instance == null) _instance = new uccustomer(); return _instance; } }
Comments
Post a Comment