private void btnAddInfo_Click(object sender, EventArgs e) { for (int i = 0; i < dgvList.Rows.Count; i++) { if (dgvList.Rows[i].Cells["clXz"].Value.ToString() == "1") { strYjsqId = dgvList.Rows[i].Cells["clmzsqid"].Value.ToString(); break; } } if (!string.IsNullOrEmpty(strYjsqId)) { FrmMessageInput FrmAvtion = new FrmMessageInput(strYjsqId); FrmAvtion.ShowDialog(); if (FrmAvtion.DialogResult == DialogResult.OK) { DataRow[] row = ((DataTable)(dgvList.DataSource)).Select("YJSQID='" + strYjsqId + "'"); if (row.Length > 0) { int index = ((DataTable)(dgvList.DataSource)).Rows.IndexOf(row[0]); this.dgvList.CurrentCell = this.dgvList.Rows[index].Cells[2]; DataGridViewCellEventArgs celle = new DataGridViewCellEventArgs(this.dgvList.CurrentCell.ColumnIndex, this.dgvList.CurrentCell.RowIndex); dgvList_CellDoubleClick(sender, celle); } } } }
private void dgvWJ_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { strYjsqId = this.dgvWJ.Rows[e.RowIndex].Cells["CLWJYJSQID"].Value.ToString(); string strMagId = this.dgvWJ.CurrentRow.Cells["CLMASSEGEID"].Value.ToString(); if (this.dgvWJ.Rows[e.RowIndex].Cells["CLMASSEGESTATE"].Value.ToString() != "ÒѲ鿴") { FrmMessageInput frmAction = new FrmMessageInput(strYjsqId, strMagId); frmAction.ShowDialog(); if (frmAction.DialogResult == DialogResult.OK) { DataRow[] row = ((DataTable)(dgvList.DataSource)).Select("YJSQID='" + strYjsqId + "'"); if (row.Length > 0) { int index = ((DataTable)(dgvList.DataSource)).Rows.IndexOf(row[0]); this.dgvList.CurrentCell = this.dgvList.Rows[index].Cells[2]; DataGridViewCellEventArgs celle = new DataGridViewCellEventArgs(this.dgvList.CurrentCell.ColumnIndex, this.dgvList.CurrentCell.RowIndex); dgvList_CellDoubleClick(sender, celle); } } } } }