FernandoPaiva FernandoPaiva - 2 months ago 69
C# Question

How to format number into reportviewer?

I'm trying format a number into ReportViewer. I want the number has the format

001
. To do this I'm trying use the format property of TextBox but still haven't success. How could I do this ?

trying.

=FormatNumber(Fields!terminal.Value, String.Format("{0:000}"))

Answer

The function FormatNumber is not going to do that for you.

Instead use the following expession in your TextBox

= Right("000" & Cstr(Fields!terminal.Value),3)

This will convert your value to a string, then add to the front 3 zero's and then return the last 3 chars of that string.

Don't set the Format property of the textBox.

Comments