|
-
May 14th, 2008, 08:29 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2008] Crystal Reports
i have a crystal report (version 9) that is already created and i want to view that report. do i need to reference anything? can someone point me in the right direction. i don't have any code yet, but i will try a few things right now.
-
May 14th, 2008, 08:49 AM
#2
Re: [2008] Crystal Reports
Create a reportdocument.
Add the report path to it (load).
put the datasource on a dataset and feed the reportdocumet with it (SetDataSource)
-
May 14th, 2008, 09:31 AM
#3
Thread Starter
Fanatic Member
Re: [2008] Crystal Reports
i'm using the express edition 2008. there is no reportdocument.
Last edited by bezaman; May 14th, 2008 at 09:49 AM.
-
May 14th, 2008, 10:02 AM
#4
Thread Starter
Fanatic Member
Re: [2008] Crystal Reports
i'm using crystal reports 9. i'm pretty sure i need to add some references. i know i'm gonna need the cr viewer control but i don't know what else i need. i want to open an existing report and view it. that's the first step. then i will need to pass it a selection formula.
-
May 14th, 2008, 12:00 PM
#5
Thread Starter
Fanatic Member
Re: [2008] Crystal Reports
is it possible to use view a crystal report using Microsoft Visual Basic 2008 Express Edition?
-
May 14th, 2008, 12:35 PM
#6
Thread Starter
Fanatic Member
Re: [2008] Crystal Reports
ok. i added these two references:
Crystal Report Viewer Control 9
Crystal Reports 9 ActiveX Designer Run Time Libarary
and i added this component:
Crystal Report Viewer Control 9
here is my code:
vb.net Code:
Public Class frmReport
Dim Appl As CRAXDRT.Application
Dim Report As CRAXDRT.Report
Private Sub frmReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Appl = New CRAXDRT.Application
Report = New CRAXDRT.Report
AxCRViewer91.DisplayBorder = False
AxCRViewer91.DisplayTabs = False
AxCRViewer91.EnableRefreshButton = False
AxCRViewer91.EnableGroupTree = False
AxCRViewer91.EnableSearchControl = False
AxCRViewer91.EnableExportButton = True
AxCRViewer91.Top = 0
AxCRViewer91.Left = 0
AxCRViewer91.Height = 14300
AxCRViewer91.Width = 19000
Report = Appl.OpenReport("J:\MDI2008\DPRequest.rpt")
AxCRViewer91.ReportSource = Report
AxCRViewer91.ViewReport()
End Sub
End Class
now i get this error:
AccessViolationException was unhandled
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
-
May 14th, 2008, 12:59 PM
#7
Thread Starter
Fanatic Member
Re: [2008] Crystal Reports
i removed the length and height. it seems that was causing the error. everything works great now.
vb.net Code:
Public Class frmReport
Private Appl As New CRAXDRT.Application
Private Report As New CRAXDRT.Report
Private Sub frmReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AxCRViewer91.DisplayBorder = False
AxCRViewer91.DisplayTabs = False
AxCRViewer91.EnableRefreshButton = False
AxCRViewer91.EnableGroupTree = False
AxCRViewer91.EnableSearchControl = False
AxCRViewer91.EnableExportButton = True
AxCRViewer91.Top = 0
AxCRViewer91.Left = 0
Report = Appl.OpenReport("J:\MDI2008\DPRequest.rpt")
AxCRViewer91.ReportSource = Report
AxCRViewer91.ViewReport()
End Sub
End Class
-
May 14th, 2008, 01:00 PM
#8
Thread Starter
Fanatic Member
Re: [2008] Crystal Reports
thanks for everyone's help. oh wait, i did it all myself. i'll give myself a pat on the back. i hope this will help somebody.
-
Mar 26th, 2010, 06:25 PM
#9
Addicted Member
Re: [RESOLVED] [2008] Crystal Reports
Hi Awesome Bezaman,
Thank you for your coding. I am having similar problem and I am trying it out your coding.
The coding with blue font is the error generator list below. Please Help me
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.shared
Imports CrystalDecisions.Windows.Forms
Public Class FrnTextCryReportViewer
Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click
Try
Dim cryfolder As String = "F:\CustReportStorage\ CrystalReportOrderDetails.rpt"
Dim cryRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
cryRpt.Load(cryfolder)
With Me.AxCrystalActiveXReportViewer1
.ReportSource = cryRpt <--generate error "This value is Write-only"
.Refresh()
End With
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End class
-
May 17th, 2013, 09:05 AM
#10
New Member
Re: [RESOLVED] [2008] Crystal Reports
This is an example of the code I am using:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim oApp = New CRAXDRT.Application
Dim oReport As CRAXDRT.Report
oReport = oApp.OpenReport("C:\temp\DR3076.R01.rpt", 1)
With oReport.Database.Tables(1).ConnectionProperties
.DeleteAll()
.Add("Provider", "SQLOLEDB.1")
.Add("User ID", "UserName")
.Add("Password", "Password")
.Add("Initial Catalog", "Database")
.Add("DSN", "DSNName")
End With
AxCrystalActiveXReportViewer1.ReportSource = oReport
AxCrystalActiveXReportViewer1.ViewReport()
End Sub
Private Sub AxCrystalActiveXReportViewer1_Enter(sender As System.Object, e As System.EventArgs) Handles AxCrystalActiveXReportViewer1.Enter
End Sub
End Class
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|