This should be simple, but either I'm blind, stupid or going mad.
I'm trying to convert a string, containing a numeric value to a double (in
C#), but when I run the code below I get the error message "Input string was
not in a correct format." Why?
string s = "8.0";
double d = Convert.ToDouble(s); 6 1811
Hi,
No reason to fail. Check your decimal symbol entry on the regional
settings/control panel. But it should parse it in anyway.
Finally you can try to use a formatprovider to assign the dot as a decimal
seperator.
Good Luck
Adnan
"henfo" <he***@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com...
This should be simple, but either I'm blind, stupid or going mad.
I'm trying to convert a string, containing a numeric value to a double (in
C#), but when I run the code below I get the error message "Input string
was
not in a correct format." Why?
string s = "8.0";
double d = Convert.ToDouble(s);
Hi,
No reason to fail. Check your decimal symbol entry on the regional
settings/control panel. But it should parse it in anyway.
Finally you can try to use a formatprovider to assign the dot as a decimal
seperator.
Good Luck
Adnan
"henfo" <he***@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com...
This should be simple, but either I'm blind, stupid or going mad.
I'm trying to convert a string, containing a numeric value to a double (in
C#), but when I run the code below I get the error message "Input string
was
not in a correct format." Why?
string s = "8.0";
double d = Convert.ToDouble(s);
Hi,
It does not fail.
The only reason I can think of is about your locale , take a look at this
overload of ToDouble() http://msdn.microsoft.com/library/de...bleTopic18.asp
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"henfo" <he***@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com... This should be simple, but either I'm blind, stupid or going mad.
I'm trying to convert a string, containing a numeric value to a double (in C#), but when I run the code below I get the error message "Input string was not in a correct format." Why?
string s = "8.0"; double d = Convert.ToDouble(s);
Hi,
It does not fail.
The only reason I can think of is about your locale , take a look at this
overload of ToDouble() http://msdn.microsoft.com/library/de...bleTopic18.asp
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"henfo" <he***@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com... This should be simple, but either I'm blind, stupid or going mad.
I'm trying to convert a string, containing a numeric value to a double (in C#), but when I run the code below I get the error message "Input string was not in a correct format." Why?
string s = "8.0"; double d = Convert.ToDouble(s);
henfo <he***@discussions.microsoft.com> wrote: This should be simple, but either I'm blind, stupid or going mad.
I'm trying to convert a string, containing a numeric value to a double (in C#), but when I run the code below I get the error message "Input string was not in a correct format." Why?
string s = "8.0"; double d = Convert.ToDouble(s);
Please see my response in one of the other newsgroups you posted to.
It's generally not a good idea to post to multiple newsgroups,
precisely for this reason. See http://www.pobox.com/~skeet/csharp/faq/posting.html for more
explanations.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
henfo <he***@discussions.microsoft.com> wrote: This should be simple, but either I'm blind, stupid or going mad.
I'm trying to convert a string, containing a numeric value to a double (in C#), but when I run the code below I get the error message "Input string was not in a correct format." Why?
string s = "8.0"; double d = Convert.ToDouble(s);
Please see my response in one of the other newsgroups you posted to.
It's generally not a good idea to post to multiple newsgroups,
precisely for this reason. See http://www.pobox.com/~skeet/csharp/faq/posting.html for more
explanations.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Irepan |
last post by:
does anybody know how to change the global IFormatProvider of my project so
everycall to Convert.ToDouble on it uses this format provider instead of the
one the one on the computer's regional...
|
by: |
last post by:
Hey
I am calling Convert.ToDouble(someString);
But this double can have to ways or representing doubles dependant on the
locale, it can be 1.0 or 1,0
Is there a way to make...
|
by: user |
last post by:
Hello
i have problems with this function, always thru exception
for all data, for example: Convert.ToDouble("545.0"). Why ?
I want to convert string data in different format into double,
i have...
|
by: ORC |
last post by:
Doing this ( global settings with comma as decimal symbol) ;
Convert.ToDouble(12....2.4..6..78);
converts to the number 1224678
but:
Convert.ToDouble(12....2.4..6..7,8);
throws an exception!
...
|
by: henfo |
last post by:
This should be simple, but either I'm blind, stupid or going mad.
I'm trying to convert a string, containing a numeric value to a double (in
C#), but when I run the code below I get the error...
|
by: Daniel Walzenbach |
last post by:
Hi,
I wonder if somebody could explain me the difference between Double.Parse and Convert.ToDouble. If I'm not mistaken they are implemented differently (I though for a moment they might be the same...
|
by: Jason |
last post by:
In VB.NET, when I use System.Convert.ToDouble(string Val) to convert a string
variable to double variable, I got something interesting:
Dim stringVal As String = "101.01"
Dim doubleVal As Double...
|
by: mrajanikrishna |
last post by:
Hi Friends,
I am accepting a number from the user entered in a textbox.
I want to assign to a variable in my code and assignt this to that
variable.
double num1 = (double)txtNum1.text;
...
|
by: trondhuso |
last post by:
Hi group,
I've found some code that I want to use in a project that I am working
on, but the code is for c# .net and not 2003 or 2005 that I have
available.
In this code the program yells on...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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,...
|
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...
| |