473,771 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(float)Convert. ToDouble c#.net c# 2003/2005

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 (float)Convert. ToDouble(xml.va lue)
(which in this case is "8.25").
I am wondering if someone could tell me how the command is changed in
2003 or 2005 as it stops here.

best

Trond

Sep 26 '07 #1
2 2334
On Sep 26, 9:07 am, trondhuso <tr-h...@online.now rote:
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 (float)Convert. ToDouble(xml.va lue)
(which in this case is "8.25").
I am wondering if someone could tell me how the command is changed in
2003 or 2005 as it stops here.

best

Trond
I actually found the solution right after this posting. the reason is
that I am in a country where we use comma as a decimal separator, so I
had to change it.
the changes are:
System.Globaliz ation.CultureIn fo enUSCulture = new
System.Globaliz ation.CultureIn fo("en-US");
(float)Convert. ToDouble(xml.Va lue, enUSCulture);

Sep 26 '07 #2

"trondhuso" <tr*****@online .nowrote in message
news:11******** **************@ w3g2000hsg.goog legroups.com...
On Sep 26, 9:07 am, trondhuso <tr-h...@online.now rote:
>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 (float)Convert. ToDouble(xml.va lue)
(which in this case is "8.25").
I am wondering if someone could tell me how the command is changed in
2003 or 2005 as it stops here.

best

Trond

I actually found the solution right after this posting. the reason is
that I am in a country where we use comma as a decimal separator, so I
had to change it.
the changes are:
System.Globaliz ation.CultureIn fo enUSCulture = new
System.Globaliz ation.CultureIn fo("en-US");
(float)Convert. ToDouble(xml.Va lue, enUSCulture);
You probably wanted the InvariantCultur e if your data has a common,
international format.

Also, you might want to look into float.Parse or float.TryParse instead of
the Convert class.
Sep 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
18536
by: Cally | last post by:
Hello, I would like to convert a field from ntext field found in one database table to float field found in another database table. The reason why I want to do this is a long one. I have tried the following and playing around with the following: declare @valuePointer varbinary(16)
4
9768
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a numeric value according to an arbitrary regular expression.
3
1547
by: ool | last post by:
Hello, How I can convert value from string to double. When I do this in that way: String sParam="150.00"; double dbValue= Convert.ToDouble(szParam); I get System.FormatEcxeption
5
17434
by: Gustaf Liljegren | last post by:
Values altered when I convert from string to float and back again: using System; class FloatTest { static void Main(string args) { string var1 = "800856.22"; Console.WriteLine(var1);
1
1872
by: Meya-awe | last post by:
Hello there, I am using a 3rd party library and a function which requires a float value in one of its methods. My data is in a string format and i tried using Convert.ToDouble and Convert.ToSingle, but didn't work either way. The value of string is "-57475.4531". The help in VS .NET 2003 tells me that these convert methods will return double and single precision float point values respectively but i needed to also cast the return to the...
4
2395
by: Gav | last post by:
Hi all, I have a value in a database which is of float and in order to get my value from my textbox into my database I am doing something along the line of sqlparm1.value= (float)Convert.ToDouble(textbox1.Text); however if I say put in 7.8 it saves it as 7.800000190
5
7873
by: vivekaseeja | last post by:
Hi , Trying to convert a string value to a float value after reading the value from an XML file , but not sure what function to use. The following only works for integers Int32.Parse (readXml.Value) ; Any suggestions for an alternate function ..
6
8598
by: trevor | last post by:
Incorrect values when using float.Parse(string) I have discovered a problem with float.Parse(string) not getting values exactly correct in some circumstances(CSV file source) but in very similar circumstances(XML file source) and with exactly the same value it gets it perfectly correct all the time. These are the results I got, XML is always correct, CSV are only incorrect for some of the values (above about 0.01) but always gives the...
9
17573
by: Marco Nef | last post by:
Hi there I'm looking for a template class that converts the template argument to a string, so something like the following should work: Convert<float>::Get() == "float"; Convert<3>::Get() == "3"; Convert<HelloWorld>::Get() == "HelloWorld"; The reason I need this is that in our design every class of a certain
0
9619
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10261
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.