From: Mark Hurd on
"Sheldon" <Sheldon(a)discussions.microsoft.com> wrote in message
news:279AB541-AC27-48DB-A39D-615C41ED4D00(a)microsoft.com...
> Hello -
>
> For some reason, I am unable to type 0.000 or 0.100 in code.
> Everytime I do
> it, it's automatically stripped away to 0.0 or 0.1.
>
> Is there a setting or something I need to change?
> --
> Sheldon

No, although the Framework's Decimal retains trailing zeros, VB is
documented to remove trailing zeros in Decimal literals at compile time
(even if you avoid it in the IDE or don't use the iDE).

So the Decimal.Parse options described in the other posts are your only
option.

(However note in my sample code below that the Const calculation occurs
"after" VB's stripping of zeros.)
--
Regards,
Mark Hurd, B.Sc.(Ma.) (Hons.)

Const b As Decimal = 2.3000D
Dim c As Decimal = 2.3000D
Dim d As Decimal = CDec("2.3000")
Dim e As Decimal = 2.3001D - 0.0001D
Const f As Decimal = 2.3001D - 0.0001D
Console.WriteLine("{0:g}", b)
Console.WriteLine("{0:g}", c)
Console.WriteLine("{0:g}", d)
Console.WriteLine("{0:g}", e)
Console.WriteLine("{0:g}", f)
Console.ReadLine()
' Output is
'2.3
'2.3
'2.3000
'2.3000
'2.3000