Does anyone know how to change the decimal separator in vb.
Thanks
Printable View
Does anyone know how to change the decimal separator in vb.
Thanks
what do you mean?Quote:
Originally Posted by guicarpi
my defaut decimal separator is a comma (i'm french).
for example : 2/4 = 0,5
But I want to change it to a dot.
for example : 2/4 = 0.5
Is it possible ?
Thanks
VB Code:
MsgBox Replace(2 / 4, ",", ".")
ok but is it possible to change the defaut value ?
Internally the decimal point isn't stored as part of the value, it's only when you display the value the decimal point is inserted into the correct position, and it will use the regional settings of your computer to determent what that is. You can change your regional settings using the control panel.
You would need to customize or change your regional settings, however that affects everything not just your vb program.
If you want you can change it with this
Many programs do it, but in my apps I prefer not to do it. I get the decimal separator each 2 seconds (the user could change it while your app is open) then I just let the user use that separator when validating the entry.
It's also possible to let him use both, and make a replace before using the numbers for calculations, but I think it's not a good idea.
if it is a program that converts a fraction to decimal you can perform the (division) math operation
2/4 will automatically become 0.5
same with 1/2 will also become 0.5