I would run all of your string inputs through the following (or something similar) before trying to assign them to an integer variable, especially when dealing with direct user input.
string myVar1;
//Something that assigns a value to myVar1
if(String.IsNullOrEmpty(myVar1))
{
myVar1 = "0";
}
else
{
int number;
bool result = Int32.TryParse(myVar1, out number);
if (result)
{
//you have a valid input and valid parse, do whatever you need with number variable
}
else
{
//bad input, reset to blank and show error message
}
}
Note the above code is an example and while fairly close to what you probably want, you will need to modify it before just copy/pasting it into your application