How to load crystal Report in my Visual Basic Apllication ?

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2008
Posts: 5
Reputation: imagetvr is an unknown quantity at this point 
Solved Threads: 0
imagetvr imagetvr is offline Offline
Newbie Poster

How to load crystal Report in my Visual Basic Apllication ?

 
0
  #1
Aug 28th, 2008
Hello

I wish to call crystal report in my VB6 Application.

For showing data report i used following code ;

Example

Date report name : datareport1
Code for showing report

Load datareport1
Datreport1.show

I have crystal report named "studentregister". please explain me how can show the crystal report in my vb6 application ?

A.Senthil
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 304
Reputation: aktharshaik is an unknown quantity at this point 
Solved Threads: 37
aktharshaik's Avatar
aktharshaik aktharshaik is offline Offline
Posting Whiz

Re: How to load crystal Report in my Visual Basic Apllication ?

 
0
  #2
Aug 28th, 2008
If crystal report is installed, then u can find the Crystal Report Viewer OCX control in VB IDE in the components. Add the crystal report control to your form and configure it to show the required report.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 'use whatever is the path of your report
  2. 'i have assumes that the rpt file is
  3. 'in the application path itself
  4. CrystalReport1.ReportFileName = App.Path & "\studentregister.rpt"
  5. CrystalReport1.Action = 1

Many other properties are also available for the control like to enable print button, to export the report, navigation of pages etc.

Hope this solves ur problem


Regards
Shaik Akthar
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 5
Reputation: imagetvr is an unknown quantity at this point 
Solved Threads: 0
imagetvr imagetvr is offline Offline
Newbie Poster

Re: How to load crystal Report in my Visual Basic Apllication ?

 
0
  #3
Aug 28th, 2008
Thanks Mr. Shaik Akthar

I added Crystal Report Viewer in components

I used your code to view report i got following error message.

Please help to solve

compile error
Method or Data Member not found

Thanks
senthil kumar.A
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 304
Reputation: aktharshaik is an unknown quantity at this point 
Solved Threads: 37
aktharshaik's Avatar
aktharshaik aktharshaik is offline Offline
Posting Whiz

Re: How to load crystal Report in my Visual Basic Apllication ?

 
0
  #4
Aug 28th, 2008
use crystal report activex control not CRViewer.

Regards
Shaik Akthar
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 304
Reputation: aktharshaik is an unknown quantity at this point 
Solved Threads: 37
aktharshaik's Avatar
aktharshaik aktharshaik is offline Offline
Posting Whiz

Re: How to load crystal Report in my Visual Basic Apllication ?

 
0
  #5
Aug 28th, 2008
CRViewer can also be used, but the coding will be slightly different

Add the Crystal App references and CrViewer component in References and Components respectively.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 'Declare these variable globally in the form module
  2. Dim crxApp As New CRAXDDRT.Application
  3. Dim crxReport As New CRAXDDRT.Report
  4. '-------------------------------------------------------------------------------------
  5.  
  6. Private Sub cmdShowReport_Click()
  7.  
  8. 'Set the report object
  9. Set crxReport = crApp.OpenReport (App.path & "\studentregister.rpt")
  10.  
  11. 'Enables the Viewer's Navigation Controls
  12. CRViewer.EnableNavigationControls = True
  13.  
  14. 'Disable Group Tree
  15. CRViewer.DisplayGroupTree = False
  16.  
  17. 'Enable export button
  18. CRViewer.EnableExportButton = True
  19.  
  20. 'Disables the CRViewer's Search control
  21. CRViewer.EnableSearchControl = True
  22.  
  23. 'Set the report source
  24. CRViewer.ReportSource = crxReport
  25.  
  26. 'View the report
  27. CRViewer.ViewReport
  28.  
  29. End Sub


Hope this helps u.

Regards
Shaik Akthar
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 5
Reputation: imagetvr is an unknown quantity at this point 
Solved Threads: 0
imagetvr imagetvr is offline Offline
Newbie Poster

Re: How to load crystal Report in my Visual Basic Apllication ?

 
0
  #6
Aug 29th, 2008
Thanks a lot Mr. Shaik Akthar

Again i disturb you . I added your code but i got error message

Dim crxApp As New CRAXDDRT.Application
Dim crxReport As New CRAXDDRT.Application



Set crxReport = crApp.OpenReport(App.Path & "\studentregister1.rpt")
( here i got error message " Variable not defined ) ( crapp )

CRViewer.EnableNavigationControls = True
CRViewer.DisplayGroupTree = False
CRViewer.EnableExportButton = True
CRViewer.EnableSearchControl = True
CRViewer.ReportSource = crxReport
CRViewer.ViewReport
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 304
Reputation: aktharshaik is an unknown quantity at this point 
Solved Threads: 37
aktharshaik's Avatar
aktharshaik aktharshaik is offline Offline
Posting Whiz

Re: How to load crystal Report in my Visual Basic Apllication ?

 
0
  #7
Aug 29th, 2008
Hi!
Just change the variable name please, i typed it wrong as crApp instead of crxApp.

Dim crxApp As New CRAXDDRT.Application
Dim crxReport As New CRAXDDRT.Application

Set crxReport = crxApp.OpenReport(App.Path & "\studentregister1.rpt")
( here i got error message " Variable not defined ) ( crapp )

CRViewer.EnableNavigationControls = True
CRViewer.DisplayGroupTree = False
CRViewer.EnableExportButton = True
CRViewer.EnableSearchControl = True
CRViewer.ReportSource = crxReport
CRViewer.ViewReport

Regards
Shaik Akthar
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC