private void btnAlter_Click(object sender, EventArgs e) { string Confirm = "修改课程需要重新生成课表,确认继续修改?"; DialogResult dr = MessageBox.Show(Confirm, "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dr == DialogResult.OK) { truncateTable(); if (grdView.DataSource == null) { MessageBox.Show("请选中要修改的行!"); query(); } else { string[] arr = new string[2]; for (int i = 0; i < 2; i++) { arr[i] = grdView[i, grdView.SelectedCells[i].RowIndex].Value.ToString(); } SubCourse alter = new SubCourse(); alter.getState(2); alter.getarr(arr); alter.ShowDialog(); } } query(); }
private void grdView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { string Confirm = "修改课程需要重新生成课表,确认继续修改?"; DialogResult dr = MessageBox.Show(Confirm, "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dr == DialogResult.OK) { truncateTable(); string[] arr = new string[2]; for (int i = 0; i < 2; i++) { arr[i] = grdView[i, grdView.SelectedCells[i].RowIndex].Value.ToString(); } SubCourse alter = new SubCourse(); alter.getState(2); alter.getarr(arr); alter.ShowDialog(); } query(); }