I have created a program, and a extensive test of it, I\'m getting a error that says \"FormatException was unhandled, Input string was not in a correct format\". The problem
The problem occurs when I leave either of the text boxes blank
That's the issue. You are using int.Parse
on an empty string. An empty string is not a valid integer representation and the parse fails.
You can test for the value in the textbox and default to something reasonable instead:
int minsEntered = 0;
int secsEntered = 0;
if(!string.IsNullOrWhitespace(textMins.Text))
{
minsEntered = int.Parse(txtMins.Text);
}
if(!string.IsNullOrWhitespace(txtSecs.Text))
{
secsEntered = int.Parse(txtSecs.Text);
}