|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Number FormatsI 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 Not really sure how you want a zero to be formatted, but
(0).ToString("000,000,000") '//Produces 000,000,000 Show quote "Vayse" <vayse@nospam.nospam> wrote in message news:OaNZfN0VGHA.4792@TK2MSFTNGP14.phx.gbl... >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 > > > > 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 ======= "This posting is provided "AS IS" with no warranties, and confers no rights." "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message Thanks, but I don't think there is a pre-defined format that matches. "N" news:tGqhwW5VGHA.5252@TK2MSFTNGXA01.phx.gbl... > 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") > 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 N0 will display the value without decimal places...
-- "Vayse" <vayse@nospam.nospam> a écrit dans le message de news: uNzzDc$VGHA.5***@TK2MSFTNGP12.phx.gbl...Show quote > "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message > news:tGqhwW5VGHA.5252@TK2MSFTNGXA01.phx.gbl... >> 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 > Thanks for Patrice's suggestion, N0 will do the trick.
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights." "OHM ( One Handed Man )" <m*@mine.com> wrote in message I don't want zero formatted. If its zero, I just want 0 displayed.news:OERLb70VGHA.2760@TK2MSFTNGP11.phx.gbl... > Not really sure how you want a zero to be formatted, but > > (0).ToString("000,000,000") '//Produces 000,000,000 > What about FormatNumber(drEconomy("Cash"),0)
Dan Show quote "Vayse" <vayse@nospam.nospam> wrote in message news:OaNZfN0VGHA.4792@TK2MSFTNGP14.phx.gbl... >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 > > > > |
|||||||||||||||||||||||