private void loadStudent() { try { var dc = new ClassSRMDataContext(Config.connection); tblStudentBindingSource.DataSource = dc.SelectStudentByClassId((int)cmbClass.EditValue); } catch (InvalidOperationException ex) { MessageBox.Show(ex.Message); } }
//Load Student private void LoadStudent() { var dc = new ClassSRMDataContext(Config.connection); int count = (cmbClass.Properties.DataSource as IList).Count; if (count > 0) { int id = (int)cmbClass.EditValue; tblStudentBindingSource.DataSource = dc.SelectStudentByClassId(id); } GC.Collect(); GC.WaitForPendingFinalizers(); }