private void button1_Click(object sender, EventArgs e) { SPClAdd sp = new SPClAdd(); sp.ShowDialog(); subjectsByClassTableAdapter.Fill(schoolDataSet.SubjectsByClass); schoolDataSet.AcceptChanges(); checkBox1.Checked = false; checkBox1.Checked = true; }
private void button2_Click(object sender, EventArgs e) { try { SPClAdd sp = new SPClAdd(Convert.ToInt32(dataGridView2.SelectedRows[0].Cells[4].Value), Convert.ToInt32(dataGridView2.SelectedRows[0].Cells[3].Value), Convert.ToInt32(dataGridView2.SelectedRows[0].Cells[1].Value), Convert.ToInt32(dataGridView2.SelectedRows[0].Cells[2].Value)); sp.ShowDialog(); subjectsByClassTableAdapter.Fill(schoolDataSet.SubjectsByClass); schoolDataSet.AcceptChanges(); dataGridView1.Refresh(); dataGridView2.Refresh(); checkBox1.Checked = false; checkBox1.Checked = true; } catch { MessageBox.Show("Ooops...please, try again"); } }