this is my code;
string a="11.4";
int b,c;
b=2;
c= convert.toint32(a) * b
I get this error;
Input string was not in a correct format
how can i convert "a"?
this is my code;
string a="11.4";
int b,c;
b=2;
c= convert.toint32(a) * b
I get this error;
Input string was not in a correct format
how can i convert "a"?
Well
ais just not an integer value - you could useConvert.ToDouble()instead. To guard against parsing errors in case that is a possibility usedouble.TryParse()instead:Edit:
Taking the comments into account, of course it is always best to specify the culture settings. Here an example using culture-indepenent settings with
double.TryParse()which would result in11.4as result: