Beispiel #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtName.Text.Trim().Length < 3)
     {
         MessageBox.Show("Student name is empty ( > 3 ).");
         return;
     }
     if (txtReg.Text.Trim().Length < 1)
     {
         MessageBox.Show("Student reg is empty ( > 1 ).");
         return;
     }
     if (txtClass.Text.Trim().Length == 0)
     {
         MessageBox.Show("Student class is empty ( > 1 ).");
         return;
     }
     if (txtSection.Text.Trim().Length == 0)
     {
         MessageBox.Show("Student section is empty ( > 1 ).");
         return;
     }
     if (btnSave.Text == "Save")
     {
         Student std = new Student(txtName.Text.Trim(), txtReg.Text.Trim(), txtClass.Text.Trim(), txtSection.Text.Trim());
         DbStudent.AddStudent(std);
         Clear();
     }
     _parent.Display();
 }
Beispiel #2
0
 public void Display()
 {
     DbStudent.DisplayAndSearch("SELECT ID, Name, Reg, Class, Section FROM student_table", dataGridView);
 }