Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: how to start with crystal reports in visual basic
If you will work wih crystal report that was shipped with Visual Studio (version 4.6), then all you do is:
1) open Crystal Report designer (external application), connect it to some datasource (for example access database), design report in it - its interface, insert database fields that should be displayed in crystal reports, and finally after you have finished all, as result you will have test.rpt file.
2) Go to Components (CTRL+T) and import Crystal report 4.6 control. Add it to form, and this is the minimum code required to show report
' needed to update location to new location of the database, since application can be installed in any dir, so you cant know in advance where the databse will reside
Me.CR.DataFiles(0) = App.Path & "\dbName.mdb"
' needed to point to report location
Me.CR1.ReportFileName = App.Path & "\test.rpt"
' Show report
frmMain.CR1.Action = 1 |
Also often is used SelectionFormula property to filter data that will be displayed.
If you decide to use newer versions of crystal report, then you have a sticky topic in this section that explains how to use it.
As for the deploying application, if using Cr 4.6, then as far as I remember you only need to distribute crystl32.ocx with your application
To deply newer versions of CR, you would need to pack much more files in installation package, cause crystal report has evolved into much serious component, with many more options available to end user. they have created merge modules that need to be deployed with application, and can be downloaded from their site.
____________________________
If you find the answer helpful, please mark this topic as solved.
|