private void gvmeterbillinvoice_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { //Edit function if (e.ColumnIndex == 20) { if (!CheckingRoleManagementFeature()) { MessageBox.Show("Access Deined for this function.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DataGridViewRow row = gvmeterbillinvoice.Rows[e.RowIndex]; MeterBillInvoiceVM meterBillInvoice = (MeterBillInvoiceVM)row.DataBoundItem;//get the selected row's data UpdateMeterbillInvoiceRecrod meterbillinvoiceUI = new UpdateMeterbillInvoiceRecrod(); meterbillinvoiceUI.vm = meterBillInvoice; meterbillinvoiceUI.Show(); } //end of edit function //print function if (e.ColumnIndex == 21) //do the print Link action { DialogResult result = MessageBox.Show( "Are you sure want to print?", "printing", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result.Equals(DialogResult.OK)) { DataGridViewRow row = gvmeterbillinvoice.Rows[e.RowIndex]; //get the selected row's data and then MeterBillInvoiceVM meterBillInvoice = (MeterBillInvoiceVM)row.DataBoundItem; //get the selected row's data } } } }
private void gvmeterbillinvoice_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { //Payment function if (e.ColumnIndex == 21) { DataGridViewRow row = gvmeterbillinvoice.Rows[e.RowIndex]; MeterBillInvoiceVM meterBillInvoice = (MeterBillInvoiceVM)row.DataBoundItem;//get the selected row's data MeterBillPaymentByCash paymentbycash = new MeterBillPaymentByCash(); paymentbycash.UserID = this.UserID; paymentbycash.vm = meterBillInvoice; paymentbycash.Show(); } //end of edit function } }