Convert String variable to Double

Hello everybody !
I need convert a string variable to double variable.
How can I do it ?
Anybody can help me ?

@silvina,

Try this

CDbl(string)

or you can use Ctype(str, double)

Hello @HareeshMR ,
I try with CDbl(string) and Ctype(string,double)
In both convert string to double, but If I want convert for example 41,40
show me 4140, the comma desappear !
How can I do it can show me the number with comma ?

@silvina,

I didn’t get that , can you explain a bit…

@silvina I think you need to look at this where some countries use a different number format with the comma and decimal swapped: Number formatting - Globalization | Microsoft Learn

I’m not sure the best way to code it, but I believe Convert.ToDouble() and CDbl() go by the Regional settings.

Regards.

2 Likes

Hi @silvina,

You can use the following method :

Convert.todouble(str).ToString(#,##)

Thanks and Regards,
P.Ajithkumar

1 Like