private void s5customVaccineUI(object sender, EventArgs e)//UCF that performs the same function as above method, but is implemented to work with textboxes in 'Other'page { //In 'Other' tabpage the vaccine types are to be entereed by the user. So if the textbox is focused by the user the corresponding groupbox is enabled to allow for date vaccinated input of the specific vaccine TextBox firstControl = (TextBox)sender; GroupBox parentContainer = (GroupBox)firstControl.Parent; Control nextControl = parentContainer.GetNextControl(firstControl, true); nextControl.Enabled = true; }
private void customVaccineCheckBoxUI(object sender, EventArgs e)//Another UCF, performs the same function as above method (testDateReveal), but is tailored to fit the format of Vaccines in Dog and Cat Pages only { CheckBox firstControl = (CheckBox)sender; GroupBox parentContainer = (GroupBox)firstControl.Parent; Control nextControl = parentContainer.GetNextControl(firstControl, true); //Enables/Disables the corresponding groupbox to allow for user input if (firstControl.Checked) { nextControl.Enabled = true; } else { nextControl.Enabled = false; } }
private void testDateReveal(object sender, EventArgs e)//An UCF for enabling and accounting for Test represented by the radiobutton control { //Enables the corresponding groupbox, which is checked (if it is enabled) and added when compiling all the inputed data RadioButton firstControl = (RadioButton)sender; GroupBox innerContainer = (GroupBox)firstControl.Parent; GroupBox outerContainer = (GroupBox)innerContainer.Parent; GroupBox nextControl = (GroupBox)outerContainer.GetNextControl(firstControl, true); //If the correct radiobutton is checked/selected then enables the corresponding groupbox, allowing for it to be considered during data compilation if (firstControl.Checked) { if (firstControl.Tag == "Expand")//Special case for HeartWorm field under the Dog page { //Enables the groupbox nextControl.Enabled = true; //Enables the next groupbox, after skipping through the groupbox's textbox items (3 fields for date) outerContainer.GetNextControl(outerContainer.GetNextControl(outerContainer.GetNextControl(outerContainer.GetNextControl(nextControl, true), true), true), true).Enabled = true; } else { nextControl.Enabled = true; } } else//Same process, but this time disables the corresponding controls when the user unchecks/de-selects the radiobutton { if (firstControl.Tag == "Expand") { nextControl.Enabled = false; outerContainer.GetNextControl(outerContainer.GetNextControl(outerContainer.GetNextControl(outerContainer.GetNextControl(nextControl, true), true), true), true).Enabled = false; } else { nextControl.Enabled = false; } } }