private void btnThemLoaisp_Click(object sender, EventArgs e) { try { LoaiSanPhamDTO loaisp = new LoaiSanPhamDTO(); if (!RB(txtMaLoaisp.Text)) { txtMaLoaisp.Focus(); errorProvider1.SetError(txtMaLoaisp, "Error!"); } else { loaisp.ma_loai = txtMaLoaisp.Text; loaisp.ten_loai_sp = txtTenLoaiSP.Text; LoaiSanPhamBUS.Insert_LSP(loaisp); MessageBox.Show("Thêm thành công !", "Thông báo", MessageBoxButtons.OK); load_data(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }