private void btn_htcapnhat_Click(object sender, EventArgs e) { try { if ((txt_makhoilop.Text != "") && (txt_tenkhoilop.Text != "")) { QLHS_DTO hs = new QLHS_DTO(); hs.MaKhoiLop = txt_makhoilop.Text; hs.TenKhoiLop = txt_tenkhoilop.Text; QLHS_BUS bus = new QLHS_BUS(); bus.CapNhatKhoiLop(hs); MessageBox.Show("Cập nhật thành công khối lớp " + txt_makhoilop.Text + " !", "Thông báo"); LoadData(); btn_themkhoilop.Enabled = true; btn_xoakhoilop.Enabled = true; btn_capnhatkhoilop.Visible = true; btn_themlop.Enabled = true; btn_htthem.Visible = false; btn_htcapnhat.Visible = false; txt_makhoilop.Enabled = false; txt_tenkhoilop.Enabled = false; txt_makhoilop.DataBindings.Clear(); txt_makhoilop.DataBindings.Add("Text", dtgv_khoilop.DataSource, "MaKhoiLop"); txt_tenkhoilop.DataBindings.Clear(); txt_tenkhoilop.DataBindings.Add("Text", dtgv_khoilop.DataSource, "TenKhoiLop"); } else { MessageBox.Show("Cập nhật không thành công! Mời bạn xem lại dữ liệu nhập! ", "Thông báo"); } } catch (Exception ex) { } }