private void AmateurRadioButton_Check(object sender, RoutedEventArgs e) //When the AmateurRadioButton is selected, all of the other options are cleared. { BloodTypeTextBox.IsEnabled = false; //Disables the blood type combo box. NextOfKinTypeTextBox.IsEnabled = false; //Disables the next of kin text box. SponsorTextBox.IsEnabled = false; //Disables the sponsor text box. SponsorTextBox.Clear(); //Clears the sponsor text box. BloodTypeTextBox.Text = ""; //Sets the bloody type combo box to nothing. This contains data we still need to we cannot clear it. NextOfKinTypeTextBox.Clear(); //Clears the next of kin text box. }
private void ProfessionalRadioButton_Check(object sender, RoutedEventArgs e) //When the ProfessionalRadioButton is selected, all of the other options are cleared. { BloodTypeTextBox.IsEnabled = false; //Disables the blood type combo box. NextOfKinTypeTextBox.IsEnabled = false; //Disables the next of kin text box. if (ProfessionalRadioButton.IsEnabled == true) //If the ProfessionalRadioButton is enabled it re-enables all of the professional boxes. { SponsorTextBox.IsEnabled = true; //Enables the sponsor text box. BloodTypeTextBox.Text = ""; //Sets the bloody type combo box to nothing. This contains data we still need to we cannot clear it. NextOfKinTypeTextBox.Clear(); //Clears the next of kin text box. } }
SkiRun activeSkiRun = new SkiRun("Skiers"); //Makes an instance of the SkiRun class so we can call methods we need for creating competitors for example. #region Clearing Text private void ClearText() //Clears the text and unchecks the radio buttons for the next competitor. { NewNameTextBox.Clear(); //Clears the new name text box for the next competitor. NewCompetitorAddressTextBox.Clear(); //Clears the new address text box for the next competitor. SponsorTextBox.Clear(); //Cleas the sponsor text box for the next competitor. BloodTypeTextBox.Text = ""; //Clears the chosen blood type for the next competitor. NextOfKinTypeTextBox.Clear(); //Clears the next of kin text box for the next competitor. AgeTextBox.Clear(); //Clears the age text box is the user decided to input their age. AmateurRadioButton.IsChecked = false; //Unchecks the amateur radio button at the start of making a new competitor. ProfessionalRadioButton.IsChecked = false; //Unchecks the professional radio button at the start of making a new competitor. CelebrityRadioButton.IsChecked = false; //Unchecks the celebrity radio button at the start of making a new competitor. }