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"); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text != "" && textBox8.Text != "" && textBox9.Text != "") { Manager.id = Convert.ToInt32(textBox1.Text); Manager.name = textBox2.Text; Manager.classs = textBox3.Text; Manager.address = textBox4.Text; Manager.phoneno = Convert.ToInt32(textBox5.Text); Manager.mobileno = Convert.ToInt32(textBox6.Text); Manager.admissiondate = textBox7.Text; Manager.comments = textBox8.Text; Manager.previousmarks = Convert.ToInt32(textBox9.Text); Manager.AddStudent(); MessageBox.Show(Manager.Err); } else { MessageBox.Show("Please fill in all the fields"); } }