473,396 Members | 1,996 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,396 software developers and data experts.

Convert String do double "," "."

Hello

How can I convert a string to double with a decimal point as seperator?

***CODE****
strNumber ="12.00"
dblDouble = Cdbl(strNumber)
****
dblDouble holds now the value 1200. But I want it to hold 12.00.

I am not very familar with CurrentUIculture,CurrentCulture,Thread.CurrentThre ad

Thanks

Michael :)
Nov 20 '05
4 7951
Formatnumber
"michi" <ww*****@gmx.ch> wrote in message
news:ec**************************@posting.google.c om...
Hello

How can I convert a string to double with a decimal point as seperator?

***CODE****
strNumber ="12.00"
dblDouble = Cdbl(strNumber)
****
dblDouble holds now the value 1200. But I want it to hold 12.00.

I am not very familar with CurrentUIculture,CurrentCulture,Thread.CurrentThre ad
Thanks

Michael :)

Nov 20 '05
Hi,

Try this.

Dim strNum As String = "12.00"

Dim dblDouble As Double = Double.Parse(strNum)

Ken

--------------------

"michi" <ww*****@gmx.ch> wrote in message
news:ec**************************@posting.google.c om...
Hello

How can I convert a string to double with a decimal point as seperator?

***CODE****
strNumber ="12.00"
dblDouble = Cdbl(strNumber)
****
dblDouble holds now the value 1200. But I want it to hold 12.00.

I am not very familar with
CurrentUIculture,CurrentCulture,Thread.CurrentThre ad

Thanks

Michael :)

Nov 20 '05
Example
This example demonstrates the FormatNumber function.

Dim myNumber As Integer = 45600
Dim myString As String
' Returns "45,600.00".
myString = FormatNumber(myNumber, 2, , ,TriState.True)"michi"
<ww*****@gmx.ch> wrote in message
news:ec**************************@posting.google.c om...
Hello

How can I convert a string to double with a decimal point as seperator?

***CODE****
strNumber ="12.00"
dblDouble = Cdbl(strNumber)
****
dblDouble holds now the value 1200. But I want it to hold 12.00.

I am not very familar with CurrentUIculture,CurrentCulture,Thread.CurrentThre ad
Thanks

Michael :)

Nov 20 '05
* ww*****@gmx.ch (michi) scripsit:
How can I convert a string to double with a decimal point as seperator?

***CODE****
strNumber ="12.00"
dblDouble = Cdbl(strNumber)
****


Did you have a look at the overloaded versions of 'Double.Parse'?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05

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

Similar topics

4
by: cindy liu | last post by:
Hi, In .Net, how to convert a string to a double? Thanks in advance! Cindy
7
by: Jim Bancroft | last post by:
Hi everyone, A basic one here, I think. I haven't found the pattern yet, but sometimes when I cast a variable to another type using the "C" style cast operator the compiler refuses to play...
2
by: Jianwei Sun | last post by:
Hi, guys, If I simply do a double d = 2.0 ,and then s=d.ToString() , it will trim the .0 off and return me 2, is there a good way to keep .0 and return me 2.0. Thanks,
17
by: David Scemama | last post by:
Hi, I'm writing a program using VB.NET that needs to communicate with a DOS Pascal program than cannot be modified. The communication channel is through some file databases, and I have a huge...
4
by: Edwin Knoppert | last post by:
In my code i use the text from a textbox and convert it to a double value. I was using Convert.ToDouble() but i'm used to convert comma to dot. This way i can assure the text is correct. However...
27
by: comp.lang.tcl | last post by:
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: set...
6
by: Dennis | last post by:
Is there anything built in to vb.net that will take a plain text string and reformat it as HTML? What I mean is: o replace newlines with <BR> o replace " with &quot; o etc. I am using vb.net...
6
by: nadeaupn | last post by:
Trying to convert "1.12" to double : Dim MyDouble as double MyDouble = cdbl("1.2") I obtain the following error message : "La conversion de la chaîne "1.2" en type 'Double' n'est pas...
1
by: niharnayak2003 | last post by:
Hi All, I am facing the problem in Typecast inside the Generic class. I need a function which will take two param 1:-Xpath 2:- XMLDOC and return me what i will need. here is the code for...
0
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
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...
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...
0
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...
0
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,...

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.