In addition to @DaniDev answers, if you are not sure content is a valid int then safer option is
int val = 0;
Int32.TryParse( TextBox1.Text, out val );
This will provide you with some default value you can use. Int32.TryParse also returns a boolean value indicating whether it was able to parse or not, so you can even use it as the condition of an if statement.
See Int32.TryParse Method (String, Int32) for more detailed information.