Decimal Digit

Hello,
I have following value in my report

1.2
1
1.234

how can I show above value
when I set decimal digit to 3
I see
1.200
1.000
1.234

I found a way :
before Textbox print
I set the value with value.tostring(#.#,###)
Is there a better way?

Comments

  • edited 2:01AM
    Hello,

    If you need to print the values as they are, set format to "General". You will get the following output:

    1.2
    1
    1.234
  • edited 2:01AM
    when I set format to "General" I see

    1.200
    1.000
    1.234

    as a note : My filed type is Decimal.

  • edited 2:01AM
    I've checked it in the "Groups" demo report. The UnitPrice field is of Decimal type. If I set format to General for this field, I get

    34
    62.5
    18
  • edited June 2009
    Another test case:

    Make a simple report with one text object. Create the BeforePrint event handler for this object:
        private void Text1_BeforePrint(object sender, EventArgs e)
        {
          decimal d = 1.2m;
          Text1.Text = d.ToString();
        }
    

    What do you see when you run a report? I see

    1.2
  • edited June 2009
    I see 1.2 and
    in demo I see correct format

    but when Assign my dataset or create a new report with Sql script
    if I have decimal field, encounter same problem
    (if I select custom format to #,0.#### it works )
  • edited 2:01AM
    When you insert a decimal data column into your report (by dragging a data column from the "Data" window), FastReport automatically sets the format for the new text object to "Currency". In your case, you need to set it to General.

Leave a Comment