void ShowDialog(string button) { Form frm = null; bool ShopInfoRequired = false; if (button != "btnShop") { DataTable dtShop = shop.SelectAllShop(); if (dtShop.Rows.Count != 1) { MessageBox.Show("Error ! Please provide the shop information to continue", "Shop Information Required", MessageBoxButtons.OK, MessageBoxIcon.Error); ShopInfoRequired = true; frm = new frmShop(); } } if (!ShopInfoRequired) { switch (button) { case "btnPOS": frm = new frmPOS(); break; case "btnSystemLog": frm = new frmSystemLog(); break; case "btnShop": frm = new frmShop(); break; case "btnUser": frm = new frmUser(); break; case "btnCompany": frm = new frmCompany(); break; case "btnCustomer": frm = new frmCustomer(); break; case "btnItem": frm = new frmItem(); break; case "btnInvoice": frm = new frmInvoice(); break; case "btnOrder": frm = new frmOrder(); break; case "btnStock": frm = new frmStock(); break; default: break; } } if (frm != null) { //this.Visible = false; if (Common.ShowModelDialogs) { frm.ShowDialog(); if (!this.IsDisposed) this.Visible = true; } else { frm.Show(); } } }
private void btnCompany_Click(object sender, EventArgs e) { frmCompany company = new frmCompany(); company.ShowDialog(); }