Crystal Reports 8.5 (VB6) to Crystal Reports NET (VB.NET) conversion 
Author Message
 Crystal Reports 8.5 (VB6) to Crystal Reports NET (VB.NET) conversion

Please help me to convert this code from VB6 to VB.NET (or C#).

 I want to load reports from file and then load actual data. Here is my
source code:

'------------------------
    Dim oCrystalRep As CRAXDRT.Report
    Dim oCrystalApp As CRAXDRT.Application

    Dim rstTemp As ADODB.Recordset

    Set oCrystalRep = New CRAXDRT.Report
    Set oCrystalApp = New CRAXDRT.Application

    Set oCrystalRep = oCrystalApp.OpenReport(App.Path & "\Reports\" & _
        "SomeReport.rpt", 1)

    oCrystalRep.DiscardSavedData

    Set rstTemp = New ADODB.Recordset

    rstTemp.Open "Select '" & mDoktekst & "' As Tekst", _
    Main.conBase, adOpenForwardOnly, adLockReadOnly, adCmdText

    oCrystalRep.DiscardSavedData
    oCrystalRep.Database.SetDataSource rstTemp

    Call PrintDocument(oCrystalRep, True)

'------------------------

Public Sub PrintDocument(ByVal CReport As CRAXDRT.Report, ByVal Preview As
Boolean, Optional ByVal Prompt As Boolean = False)

    If Preview Then

        frmPreViews.Caption = CReport.ReportTitle
        Screen.MousePointer = vbHourglass

        frmPreViews.CRViewer1.EnableExportButton = True
        frmPreViews.CRViewer1.EnableGroupTree = False
        frmPreViews.CRViewer1.EnableDrillDown = False
        frmPreViews.CRViewer1.DisplayTabs = False

        frmPreViews.CRViewer1.ReportSource = CReport
        frmPreViews.CRViewer1.Zoom (100)
        frmPreViews.CRViewer1.ViewReport

        Screen.MousePointer = vbDefault
        frmPreViews.Show vbModal, Me

    Else
        CReport.PrintOut Prompt
    End If

End Sub

Nikolay Unguzov



Sun, 03 Jul 2005 09:20:07 GMT  
 Crystal Reports 8.5 (VB6) to Crystal Reports NET (VB.NET) conversion
To load a .Net report from a file try.

ReportDocument.Load Method (string)

Private Sub LoadReport(ByVal reportName As String)
   Dim Report As New ReportDocument()
   ' Load the report.
   Report.Load(reportName)
   ' Preview the report.
   crystalReportViewer1.ReportSource = Report
End Sub

Look for in the help docs.
Crystal Reports for Visual Studio .NET


wrotE:

Quote:

>Please help me to convert this code from VB6 to VB.NET (or C#).

> I want to load reports from file and then load actual data. Here is my
>source code:

>End Sub

>Nikolay Unguzov



Sun, 03 Jul 2005 17:27:03 GMT  
 Crystal Reports 8.5 (VB6) to Crystal Reports NET (VB.NET) conversion
Thanks Griff, but I need to change data after loading report file. This is
my problem. I want to use dynamical  queries. My scenario is:

1. Load .RPT file
2. Set new data source ("Select ... Order By ...")
3. Show report

Nikolay Unguzov


Quote:
> To load a .Net report from a file try.

> ReportDocument.Load Method (string)

> Private Sub LoadReport(ByVal reportName As String)
>    Dim Report As New ReportDocument()
>    ' Load the report.
>    Report.Load(reportName)
>    ' Preview the report.
>    crystalReportViewer1.ReportSource = Report
> End Sub

> Look for in the help docs.
> Crystal Reports for Visual Studio .NET


> wrotE:

> >Please help me to convert this code from VB6 to VB.NET (or C#).

> > I want to load reports from file and then load actual data. Here is my
> >source code:

> >End Sub

> >Nikolay Unguzov



Mon, 04 Jul 2005 06:10:27 GMT  
 Crystal Reports 8.5 (VB6) to Crystal Reports NET (VB.NET) conversion
If you want to use ADO you can code as shown below.
You can also use ADO.NET as the datsourse.

        Dim cnn As New ADODB.Connection()
        Dim rs As New ADODB.Recordset()
        Dim lstrSQL As String
        Dim crpt As New RPTGenericStyle3()

        cnn.ConnectionString =
"Provider=MSDASQL.1;Password=opps;Persist Security Info=True;User
ID=cams;Data Source=System_Dev;Initial Catalog=System_Dev"
        cnn.Open()

        lstrSQL = "  SELECT * FROM dbo.Data_1 "  

        rs.Open(lstrSQL,
cnn,ADODB.CursorTypeEnum.adOpenDynamic,ADODB.LockTypeEnum.adLockOptimistic)

        crpt.SetDataSource(rs)

        CrystalReportViewer1.ReportSource = crpt

        cnn.Close()



Sun, 03 Jul 2005 23:09:28 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. vb .net crystal reports not compatible with Crystal Reports 8.5

2. Crystal Report 8.5 and VB .net

3. VB.net and crystal reports.net Multiple reports

4. how can I transfer the report from Access2000 to crystal report 8.5 or VB6.0

5. Web Reports (ASP.NET and Crystal Reports for .Net)

6. Linking Crystal Report with a stored Procedure -- crystal report for visual studio.net

7. Crystal 8.5 Pro and Crystal from VS.Net

8. i am using vb.net and crystal reports for visual studio.net

9. SetDataSource not working with Crystal Reports .NET in VB.NET

10. Error in temp file in running crystal report for .net in vb.net

11. Crystal Reports from ASP.NET without compiling VB.NET on SQL/ADO changes

12. Running Crystal 8.5 Reports on Crystal 9 RAS

 

 
Powered by phpBB® Forum Software