dreamtime Level: Protégé
 Registered: 23-05-2005 Posts: 6
|
vb.net
*EDIT*
I intended this to turn up at the end of this post...
Correct post
*EDIT*
Sorry to post to this thread but I have been wishing to do something similar ever since I got visual studio.net. I recently had a resurge in interest on getting this to work as my project now needs the ability to add graphics to a rpt via code.
I was therefore very pleased to find this thread after much searching.
I am however, having some trouble getting it to work.
I have followed the thread as closely as possible but I am getting a number of errors and hoped someone would be able to solve them.
Firstly, I have had to add CRAXDRT20.
Therefore my first 3 lines are...
Dim appl As CRAXDDRT20.Application
Dim rpt As CRAXDDRT20.Report
Dim WithEvents sect As CRAXDDRT20.Section
I have then in the form_load (testing purposes)
appl = New CRAXDDRT20.Application
rpt = appl.OpenReport("c:\test.rpt")
sect = rpt.Sections("Section2")
Try sect.ReportObjects.Item("Picture1").setolelocation("c:\test.bmp")
Catch ex As Exception
MsgBox(ex.Message)
End Try
CrystalReportViewer1.ReportSource = rpt
CrystalReportViewer1.Show()
The first error message I get (generated by the sect.reportobjects.item... line) is simply 'Access is denied'.
The second (generated by crystalreportviewer1.reportsource... line) is 'Invalid Report Source'.
I would really appreciate if anyone can solve these.
[Edited by dreamtime on 23-05-2005 at 10:21 AM GMT]
|