/// <summary> /// Function for account ledger creation /// </summary> public void AccountLedgerCreation() { try { if (cmbCashOrParty.SelectedValue != null) { strCashOrParty = cmbCashOrParty.SelectedValue.ToString(); } else { strCashOrParty = string.Empty; } if (cmbPurchaseAccount.SelectedValue != null) { strPurchaseAccount = cmbPurchaseAccount.SelectedValue.ToString(); } else { strPurchaseAccount = string.Empty; } frmAccountLedger frmAccountLedgerObj = new frmAccountLedger(); frmAccountLedgerObj.MdiParent = formMDI.MDIObj; frmAccountLedger open = Application.OpenForms["frmAccountLedger"] as frmAccountLedger; if (open == null) { frmAccountLedgerObj.WindowState = FormWindowState.Normal; frmAccountLedgerObj.MdiParent = formMDI.MDIObj; frmAccountLedgerObj.CallFromPurchaseInvoice(this); } else { open.MdiParent = formMDI.MDIObj; open.BringToFront(); open.CallFromPurchaseInvoice(this); if (open.WindowState == FormWindowState.Minimized) { open.WindowState = FormWindowState.Normal; } } this.Enabled = false; } catch (Exception ex) { MessageBox.Show("PI5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }