/// <summary> /// Refresh the form information /// </summary> private void RefreshForm() { //Create a database object to get the list of departments LibraryDB dbInfo = new LibraryDB(); List <String> departmentsList = new List <String>(); //To store the new student ID calculated by database String newStudentID = ""; //Get the new student ID newStudentID = dbInfo.getNewID("Student"); //Set the textbox to display new student ID (Can't be modified by user) txtID.Text = newStudentID; //Put the list of departments into a list departmentsList = dbInfo.getDepartments(); //Set the depart ment combo box datasource as the department list cmbDepartments.DataSource = departmentsList; //Makes it so there is no selected date when the user loads the form dtpDOB.CustomFormat = " "; //Clear the name data (for when the user wants to enter another student txtName.Text = ""; txtContactNum.Text = ""; //Makes it so there is no selected option starting off cmbGender.SelectedIndex = -1; cmbDepartments.SelectedIndex = -1; //Sets it so the maximum date is today. Technically no one can be born today and enter into the database, but its ok dtpDOB.MaxDate = DateTime.Now; }
/// <summary> /// Refresh the form information /// </summary> private void RefreshForm() { //Create a database object to get the list of departments LibraryDB dbInfo = new LibraryDB(); List <String> categoryList = new List <String>(); List <String> languageList = new List <String>(); List <String> bindingList = new List <String>(); //To store the new student ID calculated by database String newBookID = ""; //Get the new student ID newBookID = dbInfo.getNewID("Book"); //Set the textbox to display new student ID (Can't be modified by user) txtISBN.Text = newBookID; //Put the list of categories into a list categoryList = dbInfo.getCategories(); //Put the list of languages into a list languageList = dbInfo.getLanguages(); //Put the list of binding names into a list bindingList = dbInfo.getBindings(); //Set the depart ment combo box datasource as the department list cmbCategory.DataSource = categoryList; cmbLang.DataSource = languageList; cmbBinding.DataSource = bindingList; //Makes it so there is no selected date when the user loads the form dtpPubYear.CustomFormat = " "; //Clear the name data (for when the user wants to enter another student txtTitle.Text = ""; //Makes it so there is no selected option starting off cmbLang.SelectedIndex = -1; cmbCategory.SelectedIndex = -1; cmbBinding.SelectedIndex = -1; //This one is selected to the first option cmbFloorNo.SelectedIndex = 0; //Sets it so the maximum date is today. Technically no one can be born today and enter into the database, but its ok dtpPubYear.MaxDate = DateTime.Now; }