private void button1_Click(object sender, EventArgs e) { if (comboBox1.Text == "") { MessageBox.Show("You need to pick a class from the class combo"); return; } if (textBox1.Text == "") { MessageBox.Show("You need to enter the new password"); textBox1.Focus(); return; } if (textBox2.Text == "") { MessageBox.Show("You need to confirm the new password"); textBox2.Focus(); return; } if (!(textBox1.Text == textBox2.Text)) { MessageBox.Show("Your password and the confirmation don't match"); textBox1.Clear(); textBox2.Clear(); textBox1.Focus(); return; } reportManDataSetTableAdapters.ClasTableAdapter frt = new reportManDataSetTableAdapters.ClasTableAdapter(); frt.UpdateQuery(textBox2.Text, comboBox1.Text); MessageBox.Show("Form teacher has been attached to the class"); this.Close(); }
private void button1_Click(object sender, EventArgs e) { reportManDataSetTableAdapters.ClasTableAdapter cla = new reportManDataSetTableAdapters.ClasTableAdapter(); if (comboBox1.Text == "") { MessageBox.Show("You need to select a school"); return; } if (textBox1.Text == "") { MessageBox.Show("You need to enter the class"); textBox1.Focus(); return; } cla.InsertQuery(textBox1.Text, textBox1.Text, comboBox1.Text); textBox1.Clear(); comboBox1.SelectedIndex = -1; textBox1.Focus(); }