private void button1_Click(object sender, EventArgs e) { List <SinhVien> list_SV = new List <SinhVien>(); list_SV = SinhVienDAO.TimKiem_MSV(txb_MaSV.Text); if (list_SV == null) { MessageBox.Show("Không có sinh viên nào "); } else { btn_TrangSau.Enabled = false; btn_TrangTruoc.Enabled = false; pl_cha.Controls.Clear(); Label Name1 = new Label() { Text = "Mã Sinh Viên", Location = new Point(15, 0), AutoSize = true }; Label lbLop1 = new Label() { Text = "Họ Và Tên", Location = new Point(150, 0), AutoSize = true }; Label lbMASV1 = new Label() { Text = "Tên Lớp", Location = new Point(350, 0), AutoSize = true }; pl_cha.Controls.Add(Name1); pl_cha.Controls.Add(lbLop1); pl_cha.Controls.Add(lbMASV1); int i = 0; foreach (SinhVien item in list_SV) { CheckBox ckb = new CheckBox() { Text = list_SV[i].MaSV, Location = new Point(10, (i + 1) * 30) }; Label Name = new Label() { Text = list_SV[i].HoVaTen, Location = new Point(150, (i + 1) * 30) }; Label lbLop = new Label() { Text = LopDAO.LoadTenLop(list_SV[i].MaLop), Location = new Point(350, (i + 1) * 30) }; if (check_ListCB(ckb) == true) { listCheckBox.Add(ckb); } pl_cha.Controls.Add(ckb); pl_cha.Controls.Add(Name); pl_cha.Controls.Add(lbLop); } } }