Correct way to format a numeric value

Stimulsoft Reports.NET discussion
Post Reply
IanMcCarthy
Posts: 37
Joined: Wed Oct 11, 2006 3:44 am

Correct way to format a numeric value

Post by IanMcCarthy »

I have numerous numeric values, some with 1 and some with 2 decimal places (1.2 or 1.23).

I changed a textbox textformat option (in designer) from general to number and the numbers display with 2 decimal digits.

I can't change the number of decimal digits to 1 unless I untick the uselocalsetting option.

However if I do this then I lose the localisation selections for decimal and group separators.

Can I change the number of decimal places whilst still retaining localisation of decimal and group separators, etc.

What's the best way?

Many thanks

Ian
EDV Gradl
Posts: 228
Joined: Sat Jun 17, 2006 9:50 am
Location: Germany

Correct way to format a numeric value

Post by EDV Gradl »

In this kind of case I use the various ToString methodes in the OnGetValue event

if (MyCondition == 1)
e.Value = MyNumber.ToString("#,#0.0");
else
e.Value = MyNumber.ToString("#,#0.00");

I hope that helps.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Correct way to format a numeric value

Post by Vital »

Select CustomFormat and type format string - #,#0.00
Thank you.
Post Reply