Formant number

Jason
Jason used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
value=59
msgbox(value.ToString("####0.0", CultureInfo.InvariantCulture))
Senior .Net Consultant
Top Expert 2016
Commented:
do not use # otherwise leading 0 will be removed.

you can use:
dim x as string = YourIntVar.ToString("00000.0")

Open in new window

Top Expert 2016

Commented:
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

Author

Commented:
thks heap

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial