Input string was not in an incorrect format

0

I'm trying to create a geometric graph looking for a Txt file but at the start of the application this error appears I'm half beginner and I'm having trouble finding the solution

    
asked by anonymous 17.11.2016 / 00:07

2 answers

1

Your error is because you are trying to convert a nonexistent value to type INT , so you get the error;

Run-time exception (line XXX): Input string was not in a correct format.
Stack Trace:

One way to fix this would be to check if it really is a value of type int before converting it, this can be done as follows.

int number;
bool result = Int32.TryParse(texto10, out number);

See more details here , the commented lines is the example of your error.

    
17.11.2016 / 12:50
0

Check the contents of the string before converting it to Int32, the numeric format can not contain spaces or commas, or even be empty.

place a breakpoint on this line to check the value of the variable at runtime.

    
17.04.2017 / 20:36