Results 1 to 10 of 10

Thread: [RESOLVED] [2008] Crystal Reports

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779

    Resolved [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.

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    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)

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779

    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.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779

    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.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779

    Re: [2008] Crystal Reports

    is it possible to use view a crystal report using Microsoft Visual Basic 2008 Express Edition?

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779

    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:
    1. Public Class frmReport
    2.     Dim Appl As CRAXDRT.Application
    3.     Dim Report As CRAXDRT.Report
    4.  
    5.     Private Sub frmReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    6.         Appl = New CRAXDRT.Application
    7.         Report = New CRAXDRT.Report
    8.  
    9.         AxCRViewer91.DisplayBorder = False
    10.         AxCRViewer91.DisplayTabs = False
    11.         AxCRViewer91.EnableRefreshButton = False
    12.         AxCRViewer91.EnableGroupTree = False
    13.         AxCRViewer91.EnableSearchControl = False
    14.         AxCRViewer91.EnableExportButton = True
    15.         AxCRViewer91.Top = 0
    16.         AxCRViewer91.Left = 0
    17.         AxCRViewer91.Height = 14300
    18.         AxCRViewer91.Width = 19000
    19.  
    20.         Report = Appl.OpenReport("J:\MDI2008\DPRequest.rpt")
    21.  
    22.         AxCRViewer91.ReportSource = Report
    23.         AxCRViewer91.ViewReport()
    24.     End Sub
    25. 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.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779

    Re: [2008] Crystal Reports

    i removed the length and height. it seems that was causing the error. everything works great now.

    vb.net Code:
    1. Public Class frmReport
    2.     Private Appl As New CRAXDRT.Application
    3.     Private Report As New CRAXDRT.Report
    4.  
    5.     Private Sub frmReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    6.         AxCRViewer91.DisplayBorder = False
    7.         AxCRViewer91.DisplayTabs = False
    8.         AxCRViewer91.EnableRefreshButton = False
    9.         AxCRViewer91.EnableGroupTree = False
    10.         AxCRViewer91.EnableSearchControl = False
    11.         AxCRViewer91.EnableExportButton = True
    12.         AxCRViewer91.Top = 0
    13.         AxCRViewer91.Left = 0
    14.         Report = Appl.OpenReport("J:\MDI2008\DPRequest.rpt")
    15.         AxCRViewer91.ReportSource = Report
    16.         AxCRViewer91.ViewReport()
    17.     End Sub
    18. End Class

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779

    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.

  9. #9
    Addicted Member
    Join Date
    Mar 2010
    Location
    New Zealand
    Posts
    207

    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

  10. #10
    New Member
    Join Date
    Mar 2012
    Posts
    5

    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
  •  



Click Here to Expand Forum to Full Width