I have a crystal report with FieldObjects (technically "iFieldObjects") on the report from a typed Dataset. In the report I am showing Address fields for customers using 3 fieldObjects:
FieldObject_Addr1: Address1
FieldObject_Addr2: Address2
FieldObject_Concat_City_State_Zip: City, State Zip
In the vb.net code there are certain situations (ex: "Address2" value is null) when I want to hide the FieldObject and I would like to set the height of the fieldObject_Addr2 to nothing so that there is no blank line between Address1 and the City_State_Zip
values.
The main idea is that I want to programmatically, either in vb.net or in a formula on the report, change the height/width of a FieldObject at runtime.
How to do this? I tried this below but it's not working
Dim fldObjAddrLine2 As CrystalDecisions.CrystalReports.Engine.FieldObject
If myDataSet.Tables(0).Rows(i).Item("Address2") = "" Then
fldObjBillAddrLine2 = CType(crRpt.ReportDefinition.ReportObjects.Item("AddrLine2"), CrystalDecisions.CrystalReports.Engine.FieldObject)
fldObjAddrLine2.Width() = 0
fldObjAddrLine2.Height() = 0
End If
MyronCope
Participant
1656 Points
1345 Posts
Hide FieldObject on Crystal Report in the vb.net code
Nov 24, 2010 02:00 PM|LINK
Using vb.net 2005 with Crystal Reports.
I have a crystal report with FieldObjects (technically "iFieldObjects") on the report from a typed Dataset. In the report I am showing Address fields for customers using 3 fieldObjects:
FieldObject_Addr1: Address1
FieldObject_Addr2: Address2
FieldObject_Concat_City_State_Zip: City, State Zip
In the vb.net code there are certain situations (ex: "Address2" value is null) when I want to hide the FieldObject and I would like to set the height of the fieldObject_Addr2 to nothing so that there is no blank line between Address1 and the City_State_Zip values.
The main idea is that I want to programmatically, either in vb.net or in a formula on the report, change the height/width of a FieldObject at runtime.
How to do this? I tried this below but it's not working
Dim fldObjAddrLine2 As CrystalDecisions.CrystalReports.Engine.FieldObject If myDataSet.Tables(0).Rows(i).Item("Address2") = "" Then fldObjBillAddrLine2 = CType(crRpt.ReportDefinition.ReportObjects.Item("AddrLine2"), CrystalDecisions.CrystalReports.Engine.FieldObject) fldObjAddrLine2.Width() = 0 fldObjAddrLine2.Height() = 0 End If