Link to home
Create AccountLog in
Avatar of Jason
JasonFlag for Australia

asked on

Formant number

I am looking to format a number to a particular format
example
number 59
I am looking to format it to 00059.0

any help would be great
Avatar of SStory
SStory
Flag of United States of America image

value=59
msgbox(value.ToString("####0.0", CultureInfo.InvariantCulture))
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Rgonzo1971
Rgonzo1971

Hi,

pls try

value = 59
Console.WriteLine(value.ToString("00000.0"))

Open in new window

Regards
This is true...use all 0 to avoid losing 0.  ####0.0" will give you at least 0.0, and could give you more. 00000.0 will always give you all digits. For more information see Microsoft help on it.

https://msdn.microsoft.com/en-us/library/0c899ak8%28v=vs.110%29.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2
Avatar of Jason

ASKER

thks heap