private void cmbClass2_EditValueChanged(object sender, EventArgs e) { var dc = new ClassSRMDataContext(Config.connection); int count = (cmbClass2.Properties.DataSource as IList).Count; if (count > 0) { bsStudent.DataSource = dc.SelectTopYear((int)cmbClass2.EditValue); } }