private void btnLuu_Click(object sender, EventArgs e) { lsBUS lsB = new lsBUS(); LoaiSach ls = new LoaiSach(txtMaLS.Text, txtTenLS.Text, txtMoTa.Text); if (check == true) { if (lsB.CheckID(txtMaLS.Text)) { MessageBox.Show(txtMaLS.Text + " đã tồn tại!!!"); } else { if (check == true) { lsB.addLS(ls); } } } else { lsB.edit(ls); } grvLoaiSach.DataSource = lsB.getData(); }
public frmLoaiSach() { InitializeComponent(); lsBUS ls = new lsBUS(); disable(); grvLoaiSach.DataSource = ls.getData(); grvLoaiSach.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; btnLuu.Enabled = false; }