This question already has an answer here:
I have this simple piece of code for populating a ComboBox :
DataSet dt = new DataSet();
dt = db.getCourses(depID, academicYearValue, semID);
if (dt.Tables[0].Rows.Count > 0)
{
dropdownCourses.DataSource = dt.Tables[0];
dropdownCourses.DisplayMember = "Course";
dropdownCourses.ValueMember = "ID";
}
I have 4 ComboBoxes on the Form all work with the code above and get populated, only for this ComboBox when populating DataSouce i get exception :
Object reference not set to an instance of an object.
And i cannot figure out anything , any suggestions what to look for?
Aucun commentaire:
Enregistrer un commentaire