I'm trying to figure out how I can reset my windows form application once the option to do so has been selected from a choice of to radio buttons. eg:.
So once "Yes" is selected the program resets. Here is what I have been trying.
private void EndOptions() {
if (anotheryes.Checked) {
RestartForm();
}
if (anotherno.Checked) {
//todo
}
}
The restartform method is just:
private void RestartForm() {
Application.Restart();
Application.ExitThread();
}
Right now, this only works if I press the "calculate ratio" button again. On click, the application will restart. I'm wanting it so that it resets just by clicking the Yes radiobutton.
The logic behind the button is as follows:
private void DisplayLogic() {
double height = 0, waist = 0;
if (WaistNumericCheck(out waist) && HeightNumericCheck(out height)) { //check if input is numeric, if true, move on to next check
if (CheckDimensionHeight(height) == true && CheckDimensionsWaist(waist) == true) { //check if dimensions are higher than the lower limits, if BOTH true, move on the next
ShowResult(height, waist); //shows results
DisableInputs(); //disables inputs while results are being shows
AnotherGroupBoxVisible();//makes the restart selection groupbox visible
EndOptions(); //check to see which option is selected
}
}
}
Any tips/help would be greatly appreciated thanks!