Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / April 2006

Tip: Looking for answers? Try searching our database.

Number Formats

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vayse - 03 Apr 2006 18:23 GMT
I want to display numbers with a comma between every 3 digits, with no
decimal places.
I've tried
Const conFORMAT As String = "###,###,###"

Me.CashTextBox.Text = Format(drEconomy("Cash"), conFORMAT)

Which displays fine in general. For example:  999,817 will come out fine

However, if the value is zero, then the text box will be empty. Is there a
different format I can use to get 0 to displayed correclty?

Thanks

Vayse
OHM ( One Handed Man ) - 03 Apr 2006 19:45 GMT
Not really sure how you want a zero to be formatted, but

(0).ToString("000,000,000") '//Produces  000,000,000

Signature

( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net

>I want to display numbers with a comma between every 3 digits, with no
>decimal places.
[quoted text clipped - 11 lines]
>
> Vayse
Kevin Yu [MSFT] - 04 Apr 2006 04:12 GMT
Hi Vayse,

This is by design, if a digit is 0, the # will automatically ignore it and
display nothing. Please try to use a pre-defined format string like

Me.TextBox1.Text = Format(0, "N")

HTH.

Kevin Yu
Signature

=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Vayse - 04 Apr 2006 15:49 GMT
> Hi Vayse,
>
> This is by design, if a digit is 0, the # will automatically ignore it and
> display nothing. Please try to use a pre-defined format string like
>
> Me.TextBox1.Text = Format(0, "N")

Thanks, but I don't think there is a pre-defined format that matches. "N"
will still display decimal places, which I don't want to do.
I know I can check in code if the number is zero, then use a different
format, but I'm hoping there is a format that would suit.
Vayse
Patrice - 04 Apr 2006 17:05 GMT
N0 will display the value without decimal places...
Signature


>> Hi Vayse,
>>
[quoted text clipped - 9 lines]
> format, but I'm hoping there is a format that would suit.
> Vayse
Kevin Yu [MSFT] - 05 Apr 2006 02:55 GMT
Thanks for Patrice's suggestion, N0 will do the trick.

Kevin Yu
Signature

=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Vayse - 04 Apr 2006 12:37 GMT
> Not really sure how you want a zero to be formatted, but
>
> (0).ToString("000,000,000") '//Produces  000,000,000

I don't want zero formatted. If its zero, I just want 0 displayed.
Dan, Vascas - 04 Apr 2006 16:23 GMT
What about FormatNumber(drEconomy("Cash"),0)

Dan

>I want to display numbers with a comma between every 3 digits, with no
>decimal places.
[quoted text clipped - 11 lines]
>
> Vayse

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.