private void dgvInvoice_DoubleClick(object sender, EventArgs e) { if (dgvInvoice.SelectedRows.Count > 0) { DataGridViewRow row = dgvInvoice.SelectedRows[0]; SelectInvoicePrint printInvoice = new SelectInvoicePrint(); if (printInvoice.ShowDialog() == DialogResult.Yes) { if (lbSelectedCompany.Text.Contains("Parth")) { ParthInvoice objPrintInvoice = new ParthInvoice((string)row.Cells["Invoice No"].Value, printInvoice.invoicePrintType); objPrintInvoice.MdiParent = this.MdiParent; objPrintInvoice.Show(); } else if (lbSelectedCompany.Text.Contains("Industrial Instruments")) { IICInvoice objPrintInvoice = new IICInvoice((string)row.Cells["Invoice No"].Value, printInvoice.invoicePrintType); objPrintInvoice.MdiParent = this.MdiParent; objPrintInvoice.Show(); } } } }
private void btnPrintInvoice_Click(object sender, EventArgs e) { if (dgvInvoice.SelectedRows.Count > 0) { DataGridViewRow row = dgvInvoice.SelectedRows[0]; SelectInvoicePrint printInvoice = new SelectInvoicePrint(); if (printInvoice.ShowDialog() == DialogResult.Yes) { if (CultureInfo.InvariantCulture.CompareInfo.IndexOf(lbSelectedCompany.Text, "parth", CompareOptions.IgnoreCase) >= 0) { ParthInvoice objPrintInvoice = new ParthInvoice((string)row.Cells["Invoice No"].Value, printInvoice.invoicePrintType); objPrintInvoice.MdiParent = this.MdiParent; objPrintInvoice.Show(); } else if (CultureInfo.InvariantCulture.CompareInfo.IndexOf(lbSelectedCompany.Text, "industrial Instruments", CompareOptions.IgnoreCase) >= 0) { IICInvoice objPrintInvoice = new IICInvoice((string)row.Cells["Invoice No"].Value, printInvoice.invoicePrintType); objPrintInvoice.MdiParent = this.MdiParent; objPrintInvoice.Show(); } } } }