private void invoiceList_CellContentClick(object sender, DataGridViewCellEventArgs e) { DialogResult result = MessageDialog.Show("Print!", "Are you want to print the receipt now!", "print"); if (result == DialogResult.Yes) { int SelectedRow = invoiceList.CurrentCell.RowIndex; dynamic cellValue = invoiceList.Rows[SelectedRow].Cells["invoiceNo"].Value; string invoiceNumber = Convert.ToString(cellValue); InvoiceModel inv = new InvoiceModel(); dynamic invoices = inv.find_by(inv, "number", invoiceNumber); if (invoices != null) { new PrinterSelect_Frame(invoices).Show(); } } }