private void txtTimSach_TextChanged(object sender, EventArgs e) { if (txtTimSach.Text == "") { dataGridView1.DataSource = bs.GetList(); } else { if (rMa.Checked == true) { dataGridView1.DataSource = bs.TimKiem(txtTimSach.Text, "MaSach"); } else if (rNXB.Checked == true) { dataGridView1.DataSource = bs.TimKiem(txtTimSach.Text, "NhaXuatBan"); } else if (rTacGia.Checked == true) { dataGridView1.DataSource = bs.TimKiem(txtTimSach.Text, "TacGia"); } else if (rTenSach.Checked == true) { dataGridView1.DataSource = bs.TimKiem(txtTimSach.Text, "TenSach"); } else if (rTheLoai.Checked == true) { dataGridView1.DataSource = bs.TimKiem(txtTimSach.Text, "TheLoai"); } else if (rTinhtrang.Checked == true) { dataGridView1.DataSource = bs.TimKiem(txtTimSach.Text, "TinhTrang"); } } }
private void txtTimkiem_TextChanged(object sender, EventArgs e) { if (txtTimkiem.Text == "") { loadDtgvGV2(); } else { dataGridView1.DataSource = s.TimKiem(txtTimkiem.Text, "MaSach"); dataGridView1.Columns[0].HeaderText = "Mã sách"; dataGridView1.Columns[1].HeaderText = "Tên sách"; dataGridView1.Columns[2].HeaderText = "Tác giả"; dataGridView1.Columns[3].HeaderText = "Thể loại"; dataGridView1.Columns[4].HeaderText = "Nhà xuất bản"; dataGridView1.Columns[5].HeaderText = "Giá"; dataGridView1.Columns[5].HeaderText = "Số lượng"; } }