private void tsbDel_Click(object sender, EventArgs e) { if (dataGridView1.CurrentCell != null) { if (MessageBox.Show("是否删除记录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { try { CourseBll.CourseDel(dataGridView1.CurrentRow.Cells[0].Value.ToString()); MessageBox.Show("删除成功!"); dataGridView1.DataSource = CourseBll.CourseFillDs().Tables[0]; getcolumn(); } catch (Exception ee) { MessageBox.Show("删除失败!" + ee); throw; } } } }