VB How-ToAsk your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
This is what I do using Crystal Reports 9 with VB6
When creating an ActiveX Designer Report (DSR), the Crystal Reports
Gallery dialog appears. Choose From an Existing Report and browse to
the report file. The Report file will be converted to a DSR for use with the RDC in Visual Basic.
The wizard does the rest.
Then enter your code as normal.
or
Because your finished exe may end up being large / more functionality
Add a Form
Insert controls - CommonDialog1 - CRViewer91
Dim lApplication As CRAXDRT.Application
Dim lReport As CRAXDRT.Report
Private Sub mnuFileOpen_Click()
Dim strRpt As String
Dim Report
'Set filters for the Open dialog to choose only a RPT file
CommonDialog1.Filter = "Report (*.rpt)|*.rpt"
CommonDialog1.ShowOpen
'Set the filename selected to the string variable
strRpt = CommonDialog1.FileName
Set lApplication = New CRAXDDRT.Application
Set lReport = lApplication.OpenReport(strRpt) ' Open the report
CRViewer91.ReportSource = lReport
CRViewer91.ViewReport
lReport.DiscardSavedData 'CLEARS REPORT SO WE WORK FROM NEW DATA
Exit Sub
Errhandler:
MsgBox Err.Description & " " & Err.Number
End Sub
Private Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.height = ScaleHeight
CRViewer91.Width = ScaleWidth
End Sub