We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,627 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Retain decimal prior to 5th place

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.

2
Contributors
1
Reply
5 Hours
Discussion Span
4 Months Ago
Last Updated
2
Views
Lewelljo
Newbie Poster
1 post since Feb 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

This article gives more info on formating numbers into strings.

tinstaafl
Nearly a Posting Virtuoso
1,294 posts since Jun 2010
Reputation Points: 341
Solved Threads: 225
Skill Endorsements: 14

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0629 seconds using 2.78MB