Not understanding Formatting of number in vb.net

Multi tool use
Not understanding Formatting of number in vb.net
I have a routine that returns an integer and I am trying to format it to display it in a label.
Dim Freq as Integer = 14145240
Label3.text=String.Format("{0:##,##0.000}", Freq)
In the label I want it to be displayed like 14,145.240
I understand about the decimal and thousands separator and I have tried using "N3" with the culture variant but alway no matter what I try its not coming out correct. if I use Freq.ToString it shows the label as 14145240 if I just use Freq it shows as 14,145,240.
The first digits maybe 1 or 2 digits in length so it could be 14 or just 6 but I still want the layout to look the same.
Thanks
14145240
is a whole integer number. You can not display is as a decimal number without converting it to decimal. To me it looks like you should divide this number by 1000 and store the result in decimal variable and then display that decimal variable in a label..– Chetan Ranpariya
Jul 2 at 0:11
14145240
That is an integer, of course its representation would not have a decimal separator.
– Theraot
Jul 2 at 0:12
I don't know why I did not think of that.. I appreciate the answers!!!
– Rick Ellison
Jul 2 at 0:27
1 Answer
1
You should divide the number by 1000 for getting the desired format:
Label3.text=String.Format("{0:##,##0.000}", Freq/1000.0)
Label3.text=String.Format("{0:##,##0.000}", Freq/1000.0)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
please read: docs.microsoft.com/en-us/dotnet/standard/base-types/…
– codeteq
Jul 2 at 0:10