private void btnLaws_Click(object sender, EventArgs e) { int num = 0; int index = -1; for (int i = 0; i < dgvCodeSenderSet.Rows.Count; i++) { if (((DataGridViewCheckBoxCell)dgvCodeSenderSet.Rows[i].Cells[0]).Value == ((DataGridViewCheckBoxCell)dgvCodeSenderSet.Rows[i].Cells[0]).TrueValue) { num++; index = i; } } if (num <= 0) { MessageBox.Show("请选择要修改的标识卡记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } if (num > 1) { MessageBox.Show("每次只能修改一条记录...", "提示", MessageBoxButtons.OK); } else { if (index != -1) { string codesenderaddress = dgvCodeSenderSet.Rows[index].Cells[1].Value.ToString(); A_frmAddCode f = new A_frmAddCode(codesenderaddress, 1, this); f.ShowDialog(); //Flash(); } } }
private void btnAdd_Click(object sender, EventArgs e) { if (isCodeSenderSet) { A_frmCodeSenderSet f = new A_frmCodeSenderSet(this); f.ShowDialog(); //Flash(); } else { A_frmAddCode f = new A_frmAddCode(this); f.ShowDialog(); //Flash(); } }
private void btnLaws_Click(object sender, EventArgs e) { int num = 0; int index = -1; for (int i = 0; i < dgvCodeSenderSet.Rows.Count; i++) { if (((DataGridViewCheckBoxCell)dgvCodeSenderSet.Rows[i].Cells[0]).Value == ((DataGridViewCheckBoxCell)dgvCodeSenderSet.Rows[i].Cells[0]).TrueValue) { num++; index = i; } } if (num <= 0) { MessageBox.Show("请选择要修改的标识卡记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } if (num > 1) { MessageBox.Show("每次只能修改一条记录...", "提示", MessageBoxButtons.OK); } else { if (index != -1) { string codesenderaddress = dgvCodeSenderSet.Rows[index].Cells[1].Value.ToString(); A_frmAddCode f = new A_frmAddCode(codesenderaddress, 1,this); f.ShowDialog(); //Flash(); } } }