示例#1
0
        private void deletebutton_Click(object sender, EventArgs e)
        {
            Student aStudents = new Student();

            aStudents.Name = massagetextBox.Text;
            aStudents.Id   = idtextBox.Text;

            aStudents.Age = 0;
            float.TryParse(agetextBox.Text, out aStudents.Age);

            aStudents.Faculty         = facultytextBox.Text;
            aStudents.ParmanentAdress = parmanentadresstextBox.Text;
            aStudents.PresentAdress   = presentadresstextBox.Text;
            aStudents.Gender          = gendercomboBox.Text;
            aStudents.ContactNo       = contactnotextBox.Text;
            aStudents.Bloodgroup      = bloodgrouptextBox.Text;
            StudentBL StudentBLOBJ = new StudentBL();
            bool      result       = StudentBLOBJ.DeleteAStudentandSendFromDA(aStudents);

            if (result)
            {
                MessageBox.Show("The Student's Information is deleted from DB..!!");
                this.populateDataGriedview();
                updatebutton.Enabled  = true;
                deletebutton.Enabled  = true;
                cancelbutton1.Enabled = true;
                savebutton.Enabled    = true;

                massagetextBox.Text         = " ";
                idtextBox.Text              = " ";
                agetextBox.Text             = " ";
                facultytextBox.Text         = " ";
                parmanentadresstextBox.Text = " ";
                presentadresstextBox.Text   = " ";
                gendercomboBox.Text         = " ";
                contactnotextBox.Text       = " ";
                bloodgrouptextBox.Text      = " ";
            }
            else
            {
                MessageBox.Show("Result: " + StudentBLOBJ.Message);
            }
        }