private void getAppInfoButton_Click(object sender, EventArgs e) { if (databaseID.Text != "") { bool isNumeric = int.TryParse(databaseID.Text, out int n); if (isNumeric == true) { using (DBConnect dbC = new DBConnect()) { if (dbC.isAppointmentThere(Convert.ToInt32(databaseID.Text))) { userAppointment userApp = dbC.getAppointment(Convert.ToInt32(databaseID.Text)); //EnabledControls(); employeeIDBox.Text = userApp.userID.ToString(); userApp.dbID = Convert.ToInt32(databaseID.Text); appointmentDate.SetSelectionRange(userApp.appointmentDate, userApp.appointmentDate); startTimePicker.Value = userApp.startTime; endTimePicker.Value = userApp.endTime; studentIDBox.Text = Convert.ToString(userApp.studentID); subjectBox.Text = userApp.subject; if (userApp.specialProgram != null) { List <string> spPro = userApp.specialProgram.Split(',').ToList(); foreach (string sp in spPro) { switch (sp) { case "NoShow": specProgCheckbox.SetItemChecked(0, true); break; case "EOPS": specProgCheckbox.SetItemChecked(1, true); break; case "SSS": specProgCheckbox.SetItemChecked(2, true); break; case "DRC": specProgCheckbox.SetItemChecked(3, true); break; case "CalWorks": specProgCheckbox.SetItemChecked(4, true); break; case "Puente": specProgCheckbox.SetItemChecked(5, true); break; case "R3P": specProgCheckbox.SetItemChecked(6, true); break; } } } } } } else { MessageBox.Show("Non-Numeric value entered into textbox!", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Please enter in an database ID, to look up.", "Enter Database ID", MessageBoxButtons.OK, MessageBoxIcon.Error); } }