private void button1_Click(object sender, EventArgs e)
        {
            StudentDo emp = new StudentDo();

            //Removing the record
            emp.RemoveRecord(Convert.ToInt32(textBox1.Text));
            //Updating the record

            if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text != "" && textBox8.Text != "" && textBox9.Text != "")
            {
                emp.id            = Convert.ToInt32(textBox1.Text);
                emp.name          = textBox2.Text;
                emp.classs        = textBox3.Text;
                emp.address       = textBox4.Text;
                emp.phoneno       = Convert.ToInt32(textBox5.Text);
                emp.mobileno      = Convert.ToInt32(textBox6.Text);
                emp.admissiondate = textBox7.Text;
                emp.comments      = textBox8.Text;
                emp.previousmarks = Convert.ToInt32(textBox9.Text);

                emp.AddStudent();
                if (emp.Err == "Id Duplication")
                {
                    MessageBox.Show("Id already Exists");
                }
                else
                {
                    MessageBox.Show("Updated");
                }
            }
            else
            {
                MessageBox.Show("Enter all the fields");
            }
        }
示例#2
0
 private void button14_Click(object sender, EventArgs e)
 {
     if (textBox2.Visible == false)
     {
         textBox2.Visible = true;
     }
     else
     {
         StudentDo Manager = new StudentDo();
         Manager.RemoveRecord(Convert.ToInt32(textBox2.Text));
         MessageBox.Show(Manager.Err);
         textBox2.Visible = false;
     }
 }