private void btnOkSua_Click(object sender, EventArgs e) { if ((txtMaNXB.Text != "") && (txtTenNXB.Text != "")) { try { NXB_DTO nxb = new NXB_DTO(txtMaNXB.Text, txtTenNXB.Text, rtbThongTinNXB.Text); BUS_OBJ.suaNXB(nxb); HienThiDuLieu(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { btnCancel_Click(sender, e); //if (conn.State == ConnectionState.Open) conn.Close(); } } else { MetroFramework.MetroMessageBox.Show(this, "Nhập thiếu dữ liệu.", "Lỗi.", MessageBoxButtons.OK, MessageBoxIcon.Warning); if (txtTenNXB.Text == "") { txtTenNXB.Focus(); } if (txtMaNXB.Text == "") { txtMaNXB.Focus(); } } }