Tuesday, March 20, 2012

crystal reports

I have vb.net 2003 and crystal reports v10.

1) how shall I add component of crystal reports in my vb.net?

2) In crystal reports how do you find the number of the days in a particular month.(e.g. aug has 31 days & sept has 30 days). (e.g in vb.net MYDAYS_MONTH = DateTime.DaysInMonth(Now.Year, Now.Month)

3) what shall i do in order that my reports shall be displayed in vb.net while running the program. (i.e If I run the program it does not display the report but if I run the report separately then I can view the datas).

Note:
a) the database is in access.
b) it has the database password.

ThanksI'm using Crystal Reports XI, but I think the code is just about the same.

To view a report using code:

1) Add the "Crystal Report Smart Viewer" control to your project (crviewer.dll)
2) Create a form, and add a CRViewer control to the form.
3) In order to view the report in the form, your would look something like the following (I haven't had much expirience with VB.NET, but I'm sure the code would look quite similar):

Declarations:
Private crxApplication As New CRAXDRT.Application
Private crxReport As CRAXDRT.Report

This goes in your Form_Load event:
Set crxApplication = New CRAXDRT.Application

When you need to display your report:
Set crxReport = crxApplication.OpenReport(ReportFile)
crxReport.DiscardSavedData

For X = 1 To crxReport.Database.Tables.Count - 1
crxReport.Database.Tables(X).Location = FullDBPath
Next X

CrViewer.ReportSource = crxReport
CrViewer.ViewReport

I hope this helps.
-- Heather|||Dear Heather,

Thanks for your help.

I would like to inform you that I followed all your steps as you have said put still all my reports are not been displayed in my application.

Can I have your help please.

Thanks|||Did you get error or the page is not displayed properly?

No comments:

Post a Comment