private void button5_Click(object sender, EventArgs e) { //regex Regex reg = new Regex(@"^[P]\d{2,5}$"); if (!reg.IsMatch(txtMaPhieu.Text)) { MessageBox.Show("Sai định dạng mã phiếu, ví dụ: P01"); return; } if (txtTenNhanVien.Text == "" || txtTenDocGia.Text == "") { MessageBox.Show("Hãy nhập đầy đủ thông tin"); return; } DateTime ngayMuon = dtpNgayMuon.Value; PhieuMuon pm = new PhieuMuon(txtMaPhieu.Text, txtMaDocGia.Text, txtMaNhanVien.Text, ngayMuon); DialogResult tb = MessageBox.Show("Cập nhật phiếu: " + txtMaPhieu.Text + " ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (tb == DialogResult.Yes) { //cap nhat obj_phieu.SuaPhieu(pm); //hiển thị lại lên textbox string[] param = obj_phieu.layThongTinPhieu2(txtMaPhieu.Text); //dua len textbox txtMaDocGia.Text = param[0]; txtTenDocGia.Text = param[1]; dtpNgayMuon.Text = param[2]; txtMaNhanVien.Text = param[3]; txtTenNhanVien.Text = param[4]; //thông báo MessageBox.Show("Cập nhật thành công phiếu:" + txtMaPhieu.Text); } else { return; } }