By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,687 Members | 2,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,687 IT Pros & Developers. It's quick & easy.

"Specified cast is not valid" error in Crystal Reports 9.0 Develop

P: n/a
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.

Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

Currently the Crystal Report is not supported by Microsoft. Here is a KB
article which provides information on the licensing and support on Crystal
Report.

http://support.microsoft.com/?id=317789

We can also wait here to see if any community member has some idea on this.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.