Exception while converting String to integer in C#

c#, exception, type-conversion

Solution

You really should use `int.TryParse`. It is much easier to convert and you won't get exceptions.

Problem

I get error: Format exception was unhandled, Input string was not in a correct format. for this line: ``` int right = System.Convert.ToInt32(rightAngleTB.Text); ``` rightAngleTB is TextBox, the value Text is "25" (without the ""). I really don´t see the problem :(

Original source