private void btn_sua_Click(object sender, EventArgs e) { dgv_khohang.BeginEdit(true); if (tbx_makho.Text == "" || tbx_tenkho.Text == "" || tbx_tongdmsp.Text == "") { MessageBox.Show("Chọn Dòng Bạn Muốn Sửa và Hãy Nhập Đầy Đủ Thông Tin!", "Thông Báo!"); tbx_makho.Focus(); } else { if (tbx_makho.Text != dgv_khohang.CurrentRow.Cells["MAKHO"].Value.ToString().Trim() || tbx_makho.Text == "") { MessageBox.Show("Mã Kho chưa được nhập hoặc đã bị thay đổi!", "Lỗi"); } else { if (tbx_tenkho.Text == dgv_khohang.CurrentRow.Cells["TENKHO"].Value.ToString().Trim() && tbx_tongdmsp.Text == dgv_khohang.CurrentRow.Cells["TONGSODMSP"].Value.ToString().Trim() && tbx_ghichu.Text == dgv_khohang.CurrentRow.Cells["GHICHU"].Value.ToString().Trim()) { MessageBox.Show("Toàn Bộ Thông Tin Kho Hàng Đã Tồn Tại. Vui Lòng Sủa Lại!", "Thông Báo!"); } else { acc.CapNhat_Kho(tbx_makho.Text, tbx_tenkho.Text, Convert.ToInt32(tbx_tongdmsp.Text), tbx_ghichu.Text); KhoHang_Load(sender, e); } } } dgv_khohang.EndEdit(); }