I am working on a little project, that at a certain point need to convert a string
to int
.
I tried the following things:
//first try
value1 = int.TryParse(value[0].tostring(), out i)
//second
value1 = Convert.ToInt32(value[0].tostring())
//third
value1 = int.Parse(value[0].tostring())
I even wrote my own conversion method because I was at a loss.
The values I am trying to convert are queried from a MySQL
database.
Thank for your help
EDIT:
I know tryparse should have 2 params.
And the error iam getting is a formatexception Input string was not in a correct format.
I got that on all the tries.
the value in my test case is 2500 Keep in mind that that number is received from a db I tried the above snippets while using a hard coded value. And that works fine.
EDIT 2:
//http://imgur.com/NSyg2rJ