Another solution for this is to just have a check and see if your textbox is empty:
if(textBox1.Text.Equals(""))
{
int a = 0;
}
Also later on you have to use regular expressions to check if the input box contains anything other than numbers. If it doesn't then convert it to integer straight away, otherwise display an error.