Discussion Locked

Visual Basic, Crystal Reports, DLL (200

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi
I got the following situation. I have a big project with multiple reports using Crystal Reports 8.

I use Report Viewer to display those reports.
I want to get those reports from a dll, because i want to reduce the size of my exe.

I put all crystal reports designer in a active x dll, but I dont know how to call them from my exe.
Ok in my exe I have report viwer control in a form y i want to get the report from dll and asigned to mi report viewer.

Thanks For Your Attention

7 replies

by ohjani

add the Crystal Report OCX into ur project. It will automatically find all the related DLLs during the packing & deployment process.

by dushy_ant

Add a Method in your .dll to assign the crviewer with the report. The Method goes like this:

Private Rpt As New CrystalReport1 '

Public Sub AddRpt(CRW As Object) 'CRW must be assigned the name of the CRViewer
CRW.ReportSource = Rpt
CRW.ViewReport
End Sub

Call this Method from your Form Whenever you have to see the Report

eg.

Private Sub CmdViewReport_Click()
CReport.AddRpt CRViewer1
End Sub

This code works fine with my Forms

All the Best to You

by spankil

Hi,

Dushy_ant has given the answer will work fine but if there are more reports then report designer will be a bit heavy it will load on your DLL.

As DLL is in-process DLL so your program will slow down at the time of calling through your project.

In this case you can Create an out of process DLL called Active X Exe which can be open at the time of your project starts and Create a function as given by dushy_ant.

Also since you are using Crystal Report 8 you can generate report at run time and hence there is no need of Designer componet to be loaded in IDE. and Creation of Report is same as VB Coding using Crystal Reports Run time Library.

This discussion is closed to new replies.