I notice quite often that users sometimes have leading or trailing spaces in their input. Using .Trim() will get rid of leading and trailing whitespace. Then the TryParse will give you an int (if the trimmed Text is an integer) without throwing an exception
Use the following:
int right = 0; //Or you may want to set it to some other default value
if(!int.TryParse(rightAngleTB.Text.Trim(), out right))
{
// Do some error handling here.. Maybe tell the user that data is invalid.
}
// do the rest of your coding..
If the above TryParse failed, the value for right will be whatever you set it to in your declaration above. (0 in this case...)
rightAngleTB.Textdoes not contain the text2525? There aren't any extra characters in there, such as a decimal place, or extraneous whitespace? Convert.ToInt32 should definitely be able to convert a string of25to an int.