Numerical Format in Crystal Reports - by code - not working

  • Thread starter Screaming Eagles 101
  • Start date
S

Screaming Eagles 101

Hi

when I try to set the amount of decimal places I always get 2, no matter
what.

I have a formulafield in my detailsection, which I connect at runtime :

Dim colfield As FieldObject
colfield = .Section3.ReportObjects("Col1")

'=> Not Working, but no error.... I still get 2 decimals
colfield.FieldFormat.NumericFormat.DecimalPlaces = 0

'this works but not if I do the formatting afterwards, then ERROR
Still, I get 2 decimals when I get no error
rpt.DataDefinition.FormulaFields("Col1").Text = " {tblTest.Col1} "

How can I get this decimal formatting to work ?
--
Filip
http://www.ww2airborne.net/
Official Site of the 101st Airborne - 463rd PFA
skype: airborne463pfa-fiwi
[It's nice to be important, but it's more important to be nice!]
----------------------------------------------------------------
 
S

Screaming Eagles 101

Screaming Eagles 101 said:
Hi

when I try to set the amount of decimal places I always get 2, no matter
what.

I have a formulafield in my detailsection, which I connect at runtime :

Dim colfield As FieldObject
colfield = .Section3.ReportObjects("Col1")

'=> Not Working, but no error.... I still get 2 decimals
colfield.FieldFormat.NumericFormat.DecimalPlaces = 0

'this works but not if I do the formatting afterwards, then ERROR
Still, I get 2 decimals when I get no error
rpt.DataDefinition.FormulaFields("Col1").Text = " {tblTest.Col1} "

How can I get this decimal formatting to work ?
--
Filip
http://www.ww2airborne.net/
Official Site of the 101st Airborne - 463rd PFA
skype: airborne463pfa-fiwi
[It's nice to be important, but it's more important to be nice!]
----------------------------------------------------------------

Looked for a solution for weeks, nobody came up with anything,
but this morning I have seen the light.... :-/
1. the datatype of my (design) tablefield was text, I changed it into
numerical
(weird, since I connect the formulafield at runtime
to a temp. vb.net datatable column, which can be of any type... but OK...)
Standard at designtime the formule(text) is just a 0 (zero),
only at runtime I set the formula to {tbl.column}
2. most important: property 'UseSystemDefaults' of the formulafield had to
be set to False.

I thought I'd mention this, even if nobody could help, which is
understandable,
I thought what I found could be of some help to someone else...
--
Filip
http://www.ww2airborne.net/
Official Site of the 101st Airborne - 463rd PFA
skype: airborne463pfa-fiwi
[It's nice to be important, but it's more important to be nice!]
----------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top