Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Launching a simple report from VB.Net

Posted on 2004-08-11
5
Medium Priority
?
1,354 Views
Last Modified: 2007-12-19
Hi, I am trying to launch a Crystal report from VB.Net code.  I have used 2 approaches:
Method 1: Created a form with a CrystalReportViewer control.  Then, in the caller function, I put this:
----------------------------------------
Dim frmCrys As New CrystalForm()
Dim oRpt As New Crystal.CrystalReport()  
oRpt.ReportFileName = "EDILOG1.rpt"
oRpt.ReportSource = Crystal.ReportSourceConstants.crptReport
frmCrys.CRViewer1.ReportSource = oRpt
frmCrys.ShowDialog()
----------------------------------------
The result of this is a message from the Viewer saying: Invalid Report Source.
(The rpt file is where it's supposed to be and works independently)

Method 2:
----------------------------------------
 Dim cr1 As New Crystal.CrystalReport()
 With cr1
  .ReportFileName = "EDILOG1.rpt"
  .DiscardSavedData = True
 .Action = 1
End With
----------------------------------------
This one gives me an COMexception which says: "Exception from HRESULT: 0x800A5035."
Debugging:ErrorCode is -2146807755
source is "Interop.Crystal"

How do I do this right? Am on the right track with either of these approaches?


As with everything at work, this has instantly become urgent, so even though it's probably easy, I'll offer 250 points.
0
Comment
Question by:ESH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 42

Accepted Solution

by:
frodoman earned 500 total points
ID: 11775053
I don't know if you're using windows or web application but check out these fully functional sample apps and then copy & paste & edit from there...

Web: http://support.businessobjects.com/communityCS/FilesAndUpdates/vbnet_web_samples.exe.asp

Windows: http://support.businessobjects.com/communityCS/FilesAndUpdates/vbnet_win_samples.exe.asp

frodoman
0
 
LVL 10

Assisted Solution

by:ebolek
ebolek earned 500 total points
ID: 11777010
oh i think you are using wrong approach

There are two ways that you can bind your report to the viewer.
1.Strong typed reports
2.Unstrong typed reports

If you want to do strong typped reports.

1.Add your report to a project then
2. then After the application.run(new Form1);
put this
CrystalViewer1.reportsource = new ReportName();
Report Name is the name of the report that you see in the project exporer,

2. You can do it by using the report document object model
dim myreport as new crystaldecisions.crystalengine.reportdocument
myreport.load(Reportpath)

This will oad the report from your harddisk to the myreport. Then
CrystalViewer1.reportsource = myreport

Regards
Emre
0
 

Author Comment

by:ESH
ID: 11793521
The 2 of you have pointed me in the the same direction, which seems to work better, but I am using an Access database for the report data, and it tells me it can not log on.
I have not put a password on this database, so I don't know why it should fail.
Is this a requirement of doing it through this method? When I open the report directly it doesn't ask for a password.
0
 

Author Comment

by:ESH
ID: 11793951
Never mind, I found what the last problem was.  Points have been split evenly. I appreciate the help given. Thanks.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 11795253
Glad to help.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question