18.08.2013 Views

Crystal Reports™ 8.5 Developer's Guide

Crystal Reports™ 8.5 Developer's Guide

Crystal Reports™ 8.5 Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Open an existing report<br />

Ensure that you have completed the installation of the Report Designer<br />

Component files and make note of the installation directory if you did not accept<br />

the default selection.<br />

To open a report directly within Visual Basic 6.0<br />

1 Open Visual Basic and create a new Standard EXE project by selecting<br />

Standard EXE from the start up dialog or selecting it from New Project under<br />

the File menu.<br />

2 Add the Report Designer Component to Visual Basic if not already added<br />

during the installation process.<br />

3 From the Project menu, select Components.<br />

4 Click the Designers tab and check <strong>Crystal</strong> Reports 8. Click Apply and then<br />

click Close. The Report Designer is now available in this project and any<br />

projects you create in the future.<br />

5 Now we need to insert the Report Designer into the project form. On the Project<br />

menu, point to More ActiveX Designers and then click Add <strong>Crystal</strong> Reports 8.<br />

6 The <strong>Crystal</strong> Report Gallery appears displaying the different types of Report<br />

Experts that are available. Since you will be opening an existing report file,<br />

click From an Existing Report. Click OK.<br />

7 Browse to the report called World Sales Report at \<strong>Crystal</strong><br />

Reports\Sample\Reports\General Business\. Click Open. Depending on<br />

your setup, you may be presented with a dialog that asks you about adding a<br />

form at runtime. Click OK.<br />

8 The Report Designer Component is added to your project and the report<br />

layout is displayed in the design window. Report files created in any version<br />

of <strong>Crystal</strong> Reports can be imported in this manner. Before you run the report,<br />

right-click on Form2, and select View Code. You should see Visual Basic code<br />

that looks like this:<br />

Report As New <strong>Crystal</strong>Report1<br />

Dim<br />

Sub Form_Load()<br />

Private<br />

= vbHourglass<br />

Screen.MousePointer<br />

= Report<br />

CRViewer1.ReportSource<br />

CRViewer1.ViewReport<br />

= vbDefault<br />

Screen.MousePointer<br />

Sub End<br />

Sub Form_Resize()<br />

Private<br />

End Sub<br />

= 0<br />

CRViewer1.Top<br />

= 0<br />

CRViewer1.Left<br />

= ScaleHeight<br />

CRViewer1.Height<br />

= ScaleWidth<br />

CRViewer1.Width<br />

32 <strong>Crystal</strong> Reports Developer’s <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!