Symptom
How to remove currency symbol using Crystal Reports 2008 for Visual Studio .NET SDK?
Environment
- Crystal Reports 2008
- Visual Studio 2005
- Visual Studio 2008
Resolution
Use the following code to remove the currency symbol.
Sample Visual Basic .NET Code
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim reportobject As CrystalDecisions.CrystalReports.Engine.ReportObject
Dim field As CrystalDecisions.CrystalReports.Engine.FieldObject
Dim numericFormat As CrystalDecisions.CrystalReports.Engine.NumericFieldFormat
crReportDocument.Load(<RPT file full path>)
For Each reportobject In crReportDocument.ReportDefinition.ReportObjects
If reportobject.Kind = CrystalDecisions.Shared.ReportObjectKind.FieldObject Then
field = reportobject
If field.DataSource.ValueType = CrystalDecisions.Shared.FieldValueType.NumberField Or field.DataSource.ValueType = CrystalDecisions.Shared.FieldValueType.CurrencyField Then
numericFormat = field.FieldFormat.NumericFormat
numericFormat.CurrencySymbolFormat = CurrencySymbolFormat.NoSymbol
End If
End If
Next
CrystalReportViewer1.ReportSource = crReportDocument
Keywords
CR for .NET, dotnet, VS.NET, CR.NET , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To