private void txtDate2_DateTimeChanged(object sender, EventArgs e) { var dc = new ClassSRMDataContext(Config.connection); if (chkFilter.Checked) { int count = (cmbClass.Properties.DataSource as IList).Count; if (count > 0) { int id = (int)cmbStudent.EditValue; checkVBindingSource.DataSource = dc.Select2Dates(id, txtDate1.Text, txtDate2.Text); } } }