private void dgSheetMaster_DoubleClick(object sender, EventArgs e) { ppMsg = new PopupMessage(); try { if (dgSheetMaster.CurrentRow.Index != -1 && dgSheetMaster.CurrentRow.Cells[1].Value != null) { var SID = Convert.ToInt32(dgSheetMaster.CurrentRow.Cells[0].Value); if (!Dashboard.Instance.PnlContainer.Controls.ContainsKey("AddProduct_SheetUC")) { Dashboard.Instance.PnlContainer.Controls.Clear(); AddProduct_SheetUC un = new AddProduct_SheetUC(SID); un.Dock = DockStyle.Fill; Dashboard.Instance.PnlContainer.Controls.Add(un); } Dashboard.Instance.PnlContainer.Controls["AddProduct_SheetUC"].BringToFront(); Dashboard.Instance.BackButton.Visible = true; } } catch (Exception x) { ppMsg.infoMessage("Something went wrong. Contact your system administrator!"); } }
private void button1_Click(object sender, EventArgs e) { if (!Dashboard.Instance.PnlContainer.Controls.ContainsKey("AddProduct_SheetUC")) { Dashboard.Instance.PnlContainer.Controls.Clear(); AddProduct_SheetUC un = new AddProduct_SheetUC(); un.Dock = DockStyle.Fill; Dashboard.Instance.PnlContainer.Controls.Add(un); } Dashboard.Instance.PnlContainer.Controls["AddProduct_SheetUC"].BringToFront(); Dashboard.Instance.BackButton.Visible = true; }