private void btnTimKiem_Click(object sender, EventArgs e) { try { ValidateSearch(); thLop = new Thread(() => { object source = LopHoc.SelectAll(txtMaLop.Text); gridLop.Invoke((MethodInvoker) delegate { gridLop.DataSource = source; }); }); thLop.Start(); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception ex) { MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnHienTatCa_Click(object sender, EventArgs e) { thLop = new Thread(() => { object source = LopHoc.SelectAll(); gridLop.Invoke((MethodInvoker) delegate { gridLop.DataSource = source; }); }); thLop.Start(); }
private void btnTimKiem_Click(object sender, EventArgs e) { try { ValidateSearch(); gridLop.DataSource = LopHoc.SelectAll(chkMaLop.Checked ? txtMaLop.Text : null, chkTenLop.Checked ? txtTenLop.Text : null, chkKhoa.Checked ? cboKhoa.SelectedValue.ToString() : null, chkKhoangTG.Checked ? (DateTime?)dateTuNgay.Value : null, chkKhoangTG.Checked ? (DateTime?)dateDenNgay.Value : null, chkTinhTrang.Checked ? (bool?)rdMo.Checked : null); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception ex) { MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnHienTatCa_Click(object sender, EventArgs e) { gridLop.DataSource = LopHoc.SelectAll(); gridLop_Click(sender, e); }