G
Guest
I posted this question on the Crystal Reports Support site and I am still
waiting for an answer.
Using Crystal Reports 9.0 Developer Full edition:
My Crystal report .RPT file has a Picture box which is an OLE Object located
in the Page Header section of my .RPT file.
This is the call which works perfectly in VB6 to format the crystal reports
Page Header section of my report file EquipLst.rpt.
This format procedure causes a Logo file to be loaded into the Picture box
in the Page Header section of the report using the VB Load picture method.
Private Sub crSectionPH_format(ByVal pFormattingInfo As Object)
' check each object in the Page Header section
For Each crObject In crSectionPH.ReportObjects
' we are only considering if it is an OLE object
Select Case crObject.Kind
Case craxdrt.CRObjectKind.crOleObject:
Dim crxPicture As craxdrt.OLEObject
Set crxPicture = crObject
pix = RO_CompanyInfoDS("Company_Logo")
Set crxPicture.FormattedPicture = LoadPicture(pix)
Exit Sub
End Select
Next crObject
End Sub
After UPGRADE to Visual Studio 2003 .NET the code is:
Private Sub crSectionPH_format(ByVal pFormattingInfo As Object) Handles
crSectionPH.format
' check each object in the section
Dim crxPicture As CRAXDRT.OleObject
For Each crObject In crSectionPH.ReportObjects
' we are only considering if it is an OLE object
'UPGRADE_WARNING: Couldn't resolve default property of object
crObject.Kind. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
Select Case crObject.Kind
Case CRAXDRT.CRObjectKind.crOleObject
crxPicture = crObject
pix = RO_CompanyInfoDS.Fields("Company_Logo").Value
'--------------------------------------------
crxPicture.FormattedPicture = System.Drawing.Image.FromFile(pix)
'Indicates that "Specified cast is not valid"
'--------------------------------------------
Exit Sub
End Select
Next crObject
End Sub
After looping through the objects in the page header of my Crystal Reports
Form, and finding an crOleObject of Type Picture,
and reading the path of the Bitmap picture from:
RO_CompanyInfoDS.Fields("Company_Logo").Value
and assigning it to the GLOBAL string pix,
the next line:
crxPicture.FormattedPicture = System.Drawing.Image.FromFile(pix)
'Indicates that "Specified cast is not valid"
After upgrade from vb6 I get this error. If any crystal report experts are
reading this problem... How can I fix this?
Thanking you in advance.
waiting for an answer.
Using Crystal Reports 9.0 Developer Full edition:
My Crystal report .RPT file has a Picture box which is an OLE Object located
in the Page Header section of my .RPT file.
This is the call which works perfectly in VB6 to format the crystal reports
Page Header section of my report file EquipLst.rpt.
This format procedure causes a Logo file to be loaded into the Picture box
in the Page Header section of the report using the VB Load picture method.
Private Sub crSectionPH_format(ByVal pFormattingInfo As Object)
' check each object in the Page Header section
For Each crObject In crSectionPH.ReportObjects
' we are only considering if it is an OLE object
Select Case crObject.Kind
Case craxdrt.CRObjectKind.crOleObject:
Dim crxPicture As craxdrt.OLEObject
Set crxPicture = crObject
pix = RO_CompanyInfoDS("Company_Logo")
Set crxPicture.FormattedPicture = LoadPicture(pix)
Exit Sub
End Select
Next crObject
End Sub
After UPGRADE to Visual Studio 2003 .NET the code is:
Private Sub crSectionPH_format(ByVal pFormattingInfo As Object) Handles
crSectionPH.format
' check each object in the section
Dim crxPicture As CRAXDRT.OleObject
For Each crObject In crSectionPH.ReportObjects
' we are only considering if it is an OLE object
'UPGRADE_WARNING: Couldn't resolve default property of object
crObject.Kind. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
Select Case crObject.Kind
Case CRAXDRT.CRObjectKind.crOleObject
crxPicture = crObject
pix = RO_CompanyInfoDS.Fields("Company_Logo").Value
'--------------------------------------------
crxPicture.FormattedPicture = System.Drawing.Image.FromFile(pix)
'Indicates that "Specified cast is not valid"
'--------------------------------------------
Exit Sub
End Select
Next crObject
End Sub
After looping through the objects in the page header of my Crystal Reports
Form, and finding an crOleObject of Type Picture,
and reading the path of the Bitmap picture from:
RO_CompanyInfoDS.Fields("Company_Logo").Value
and assigning it to the GLOBAL string pix,
the next line:
crxPicture.FormattedPicture = System.Drawing.Image.FromFile(pix)
'Indicates that "Specified cast is not valid"
After upgrade from vb6 I get this error. If any crystal report experts are
reading this problem... How can I fix this?
Thanking you in advance.