private void dgvDauSach_CellClick(object sender, DataGridViewCellEventArgs e) { if ((e.RowIndex >= 0 && e.ColumnIndex >= 0) && kt == 1) { txtMaSach.Text = dgvDauSach.CurrentRow.Cells["masach"].Value.ToString(); txtTenSach.Text = dgvDauSach.CurrentRow.Cells["tensach"].Value.ToString(); txtTacGia.Text = dgvDauSach.CurrentRow.Cells["tacgia"].Value.ToString(); txtTheLoai.Text = dgvDauSach.CurrentRow.Cells["theloai"].Value.ToString(); txtViTri.Text = dgvDauSach.CurrentRow.Cells["vitri"].Value.ToString(); txtNhaXB.Text = dgvDauSach.CurrentRow.Cells["nxb"].Value.ToString(); DataTable dt = DauSachBUS.LoadMaHD("select_mahd", txtMaSach.Text); cboMaHD.DataSource = dt; cboMaHD.DisplayMember = "mahd"; cboMaHD.ValueMember = "mahd"; string a = cboMaHD.SelectedValue.ToString(); int tong = 0; for (int i = 0; i < dt.Rows.Count; i++) { tong += int.Parse(dt.Rows[i]["soluong"].ToString()); } txtTongSoLuong.Text = tong.ToString(); txtTongSoLuong.Enabled = true; lblSoLuong.Enabled = true; } }