private void Find_btn_Click(object sender, RoutedEventArgs e) { //Calls find function from ModuleList if (txtBox_MatricFind.Text == "") { MessageBox.Show("Please enter a matriculation number to find"); } else { //Uses find function in ModuleList to search matric numbers using matric supplies in txtbox Student x = store.find(Convert.ToInt32(txtBox_MatricFind.Text)); //Returns a message if record isnt found and return is null. if (store.find(Convert.ToInt32(txtBox_MatricFind.Text)) == null) { MessageBox.Show("Record not found"); txtBox_MatricFind.Clear(); } else { //if record is found then uses getdetails function in student to show student object information MessageBox.Show(x.getDetails()); //clears the txtbox txtBox_MatricFind.Clear(); } } }
//Allows user to select matriculation number from listbox and view student object details private void lstbox_MatricNumbers_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { //Uses find function in ModuleList to search matric numbers using matric supplies in txtbox Student x = store.find(Convert.ToInt32(lstbox_MatricNumbers.SelectedItem)); MessageBox.Show(x.getDetails()); } catch { MessageBox.Show("Record has been deleted"); } }