/* Adds all the boxes into lists. Fills the comboboxes with information. * This function contains all code that needs to be executed when the control is first loaded */ private void LoadAddStudentControl(object sender, EventArgs e) { phoneNumbers = new List <String>(); phoneTypes = new List <String>(); textBoxes = new List <TextBox>() { studentIDBox, firstnameBox, lastnameBox, streetAdressBox, zipcodeBox, cityBox, countryBox, phoneNumberBox, }; comboBoxes = new List <ComboBox>() { genderComboBox, phoneTypeComboBox, StudentTypeComboBox, }; DataTable phTable = dbconn.getPhTypesFromDB(); phTable = dbconn.getPhTypesFromDB(); phoneTypeComboBox.DataSource = phTable; phoneTypeComboBox.DisplayMember = "PhoneType"; DataTable studentTypeTb = dbconn.getStTypesFromDB(); StudentTypeComboBox.DataSource = studentTypeTb; StudentTypeComboBox.DisplayMember = "_Type"; }