Dec 22, 2010 5:45 pm
Mpgiven
Excel.Range rng1 = _xlWorkSheet.get_Range(rangeName, Type.Missing);
string cash = String.Format("{0: ###,###.##}",
rng1.Value2);
I get the string "123,546"
but it should be "123,546.00"
what am i doing wrong?
thanks
mark
Dec 22, 2010 5:50 pm
Mp"mp" <nospam@Thanks.com> wrote in message
news:ietdf7$f8d$1@news.eternal-september.org...
> given
> Excel.Range rng1 = _xlWorkSheet.get_Range(rangeName, Type.Missing);
> string cash = String.Format("{0: ###,###.##}",
> rng1.Value2);
>
> I get the string "123,546"
> but it should be "123,546.00"
>
> what am i doing wrong?
> thanks
> mark
>
> Excel.Range rng1 = _xlWorkSheet.get_Range(rangeName, Type.Missing);
> string cash = String.Format("{0: ###,###.##}",
> rng1.Value2);
>
> I get the string "123,546"
> but it should be "123,546.00"
>
> what am i doing wrong?
> thanks
> mark
>
nevermind, got it...don't understand why it works but i tried this
string cash = String.Format("{0: ###,###.00}", rng1.Value2);
and it works even if the last two digits aren't 0.
thanks
mark
Dec 22, 2010 7:07 pm
Jeff Johnson"mp" <nospam@Thanks.com> wrote in message
news:ietdf7$f8d$1@news.eternal-september.org...
> given
> Excel.Range rng1 = _xlWorkSheet.get_Range(rangeName, Type.Missing);
> string cash = String.Format("{0: ###,###.##}",
> rng1.Value2);
>
> I get the string "123,546"
> but it should be "123,546.00"
>
> what am i doing wrong?
> Excel.Range rng1 = _xlWorkSheet.get_Range(rangeName, Type.Missing);
> string cash = String.Format("{0: ###,###.##}",
> rng1.Value2);
>
> I get the string "123,546"
> but it should be "123,546.00"
>
> what am i doing wrong?
Forgetting even your basic VB training, that's what. Using 0 as a
placeholder instead of # FORCES a digit there, even if it's 0. Format$()
uses the same rules; I'm surprised you've never run across it before. Tsk
tsk, Mark!
Dec 22, 2010 8:48 pm
Mp"Jeff Johnson" <i.get@enough.spam> wrote in message
news:ieti9d$plf$1@news.eternal-september.org...
> "mp" <nospam@Thanks.com> wrote in message
> news:ietdf7$f8d$1@news.eternal-september.org...
>
> Forgetting even your basic VB training, that's what. Using 0 as a
> placeholder instead of # FORCES a digit there, even if it's 0. Format$()
> uses the same rules; I'm surprised you've never run across it before. Tsk
> tsk, Mark!
> news:ietdf7$f8d$1@news.eternal-september.org...
>
>> given
>> Excel.Range rng1 = _xlWorkSheet.get_Range(rangeName, Type.Missing);
>> string cash = String.Format("{0: ###,###.##}",
>> rng1.Value2);
>>
>> I get the string "123,546"
>> but it should be "123,546.00"
>>
>> what am i doing wrong?
>>> Excel.Range rng1 = _xlWorkSheet.get_Range(rangeName, Type.Missing);
>> string cash = String.Format("{0: ###,###.##}",
>> rng1.Value2);
>>
>> I get the string "123,546"
>> but it should be "123,546.00"
>>
>> what am i doing wrong?
> Forgetting even your basic VB training, that's what. Using 0 as a
> placeholder instead of # FORCES a digit there, even if it's 0. Format$()
> uses the same rules; I'm surprised you've never run across it before. Tsk
> tsk, Mark!
yeah i'm even more ashamed of me than you are
:-)
i've probably seen it in the dim past but dont' recall ever having to use
it.
it did eventually surface in my brain but took a while
:-)
you're awfully gentle in your upbrading(compared to what i deserve)...must
be in the christmas spirit
Previous Thread: App.config ??
Next Thread: Unable to save byte[] to database