469,623 Members | 1,523 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

error when converting string decimal to integer

i am getting error "input string was not in correct format" when
converting a string decimal into integer value.

code is like this:

string strVal = "";
int nVal = 0;

strVal = "14.9";
nVal += Convert.toInt32(strVal);

Above code is a function which is in a dll and its return type is int.
So i cant just change the convertion to decimal as this function is
being used in other projects. Any body has some clue or suggestion
which is appreciated.

Mar 27 '06 #1
1 9717

<md******@gmail.com> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.com...
i am getting error "input string was not in correct format" when
converting a string decimal into integer value.

code is like this:

string strVal = "";
int nVal = 0;

strVal = "14.9";
nVal += Convert.toInt32(strVal);

Above code is a function which is in a dll and its return type is int.
So i cant just change the convertion to decimal as this function is
being used in other projects. Any body has some clue or suggestion
which is appreciated.


convert the string to decimal and then cast the decimal to int.
Mar 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Peter Warder | last post: by
13 posts views Thread by Gil | last post: by
4 posts views Thread by rainmaker1234 | last post: by
9 posts views Thread by priyanka | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.