Question

I have values in a db:

10.4
33
42.87
1.01
22.1
8

I know I can format numbers in my RDLC reports, however, how can I make sure that the output of the data will always be:

10.40
33.00
42.87
1.01
22.10
8.00

you will notice that I need to show two decimal points, even if the number has none,

Was it helpful?

Solution

Argh.... google helped, it is quite simple:

=FormatNumber(Fields!SomeField.Value,2)

OTHER TIPS

You can also use Format property of your TextBox; for example:

Format = "f2"

Using Format you can use "c" to format currency (i.e. "c2").

Right click that Control[TextBox] in RDLC, TextBox Properties, SelectNumber,CAtegory-Number , See Decimal Places is 2, Click Ok.

FormatCurrency(Expression as object, NumDigitsAfterZero as tristate, IncludingLeadingDigit as tristate, UwseParenseForNegativeNumbers as tristate, GroupDigits as tristate) as string

I tried using the Number tab settings for the placeholder and that didn't do anything. The above works.

ReportParameter[] param = new ReportParameter[3];
param[0] = new ReportParameter("LumpsumDiscount", lumpsumdiscount.ToString(), false);
param[1] = new ReportParameter("PaymentDetailType", paymenttype, false);
param[2] = new ReportParameter("ChargesAmount", Samount.ToString(), false);
this.reportViewer.LocalReport.SetParameters(param);

Now:

chargesAmount showing 28000.0000 instead of 28000.00

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top