1,105,290 Community Members

Retain decimal prior to 5th place

Member Avatar
Newbie Poster
1 post since Feb 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]

Please excuse the noob-ness. Here's the code:

Dim value As Double = LimitString
LimitString = 0.01
LimitString = value.ToString("e1", CultureInfo.InvariantCulture)

I'm trying to retain a value "0.01" as that instead of it being converted to "1.0-002".
Aftert the fourth decimal place it needs to be scientific. Foe example "0.00001" would be "1.0e-005".
I know there is a simple way to do this but for the life of me I cannot find it. Any and all help
is very much appreciated.

Member Avatar
2,012 posts since Jun 2010
Reputation Points: 559 [?]
Q&As Helped to Solve: 402 [?]
Skill Endorsements: 35 [?]

try this:
LimitString = value.ToString("e5", CultureInfo.InvariantCulture)

This article gives more info on formating numbers into strings.

This article has been dead for over three months: Start a new discussion instead
Start New Discussion
Tags Related to this Article