Пример #1
0
 private void btnXoaHocSinh_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có chắc chắn không?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         HocSinh hs = new HocSinh()
         {
             TenHS = this.txtTenHocSinh.Text, DiaChi = this.txtDiaChi.Text, MaHS = this.txtMaHocSinh.Text
         };
         if (hocSinhBUS.Delete(hs))
         {
             MessageBox.Show("Xóa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             ClearAllTextbox();
             this.dgvHocSinh.DataSource = hocSinhBUS.LoadData().Tables[0].DefaultView;
         }
         else
         {
             MessageBox.Show("Xóa thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }