private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex > 0) { DataGridView dgv = (DataGridView)sender; if (dgv.Columns[e.ColumnIndex].Name == "BtnClear") { DataGridViewRow dgr = dataGridView1.CurrentRow; int intStatusID = Convert.ToInt32(dgr.Cells["StatusID"].Value); if (intStatusID == 4) { DialogResult dialogResult = MessageBox.Show("确定清算该当票?", "清算", MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.OK) { int intTicketID = Convert.ToInt32(dgr.Cells["TicketID"].Value); ClearOperationForm frmClearOperation = new ClearOperationForm(intTicketID); frmClearOperation.Show((DockPanel)MainForm.pCurrentWin.Controls["dockPanel1"]); } } else { MessageBox.Show("该当票不能进行清算处理!", "清算"); } } } }
private void btnClear_Click(object sender, EventArgs e) { DataGridViewRow dgr = dataGridView1.CurrentRow; int intTicketID = Convert.ToInt32(dgr.Cells["TicketID"].Value); ClearOperationForm frmClearOperation = new ClearOperationForm(intTicketID); frmClearOperation.Show((DockPanel)MainForm.pCurrentWin.Controls["dockPanel1"]); }