473,394 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 9952

<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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Peter Warder | last post by:
I'm a newbie and I'm sorry this is so basic but . . . . If I have a String containing "123", how do I convert it to an Integer variable? I've tried all kinds of Integer.valueOf("123")...
13
by: Gil | last post by:
I have a string : string A = "2"; I need to get it's integer value : // ?? int val = A ; // ??
4
by: rainmaker1234 | last post by:
Its very simple in VC++. In the followeing code I have declared a String, and a double than I am taking the string and converting it into Double. getch() at the end is only to pause the screen so...
15
by: Br | last post by:
Cint(3/2) = 2 (rounded up, I would have thought the answer would be 1) Cint(5/2) = 2 (rounded down) The Access help says Cint() rounds to the nearest even number, but why?? Do I need to...
9
by: priyanka | last post by:
Hi there, I want to convert a String into integer. I get the string froma file using : string argNum; getline(inputStream,argNum); I now need to convert argNum into integer.
2
by: Tukeind | last post by:
Hello, I am receiving the following error: error C2065: 'to_binary' : undeclared identifier while running the code below. If anyone can help I'll appreciate it? Thank you, Tukeind
2
by: clintonb | last post by:
Victor said: The double value that I'm trying to convert to GCSMoney (which is implemented as cents) was produced by multiplying a dollar amount by an interest rate to get interest. double...
0
by: Treesa Franco | last post by:
I wanted to convert an aspx page contents to PDF.I am using iText in my project. While running i encountered the following problems.Can anyone help? Server Error in '/' Application. Font size...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.