tailieunhanh - Crystal Reports For Visual Studio 2005 phần 7

Trong hướng dẫn này, bạn tìm hiểu làm thế nào để tạo một dự án Windows trong Crystal Reports cho Visual Studio 2005. Sau đó bạn thêm một điều khiển CrystalReportViewer để Windows Form. Từ bảng điều khiển công tác thông minh, bạn mở Crystal nhúng Báo cáo thiết kế và tạo ra một báo cáo mới. | Walkthroughs customersVialdrReport end C customersVialdrReport end You are now ready to build and run your project. Skip to the next section below. To instantiate the CustomersVialDR report as a non-embedded report and bind it to the CrystalReportViewer control 1. Open the Web or Windows Form. 2. From the View menu click Code. 3. Add a new class-level declaration for the ReportDocument report wrapper class using the variable name customersViaIdrReport. Set its access modifier to private. Visual Basic Private customersVialdrReport As ReportDocument .Lend . C private ReportDocument customersViaIdrReport end Note The ReportDocument class is a member of the namespace. You have added an Imports Visual Basic or using C declaration for this namespace in Appendix Project Setup. When you instantiate ReportDocument and load a report into the namespace you gain access to the report through the SDK without embedding the report. 4. Within the ConfigureCrystalReports method that you have created in Appendix Project Setup instantiate the ReportDocument class. Visual Basic customersViaIdrReport New ReportDocument end C customersViaIdrReport new ReportDocument end . 5. Declare a string variable name it reportPath and assign to it a runtime path to the local report. This path is determined differently for Web Sites and Windows projects For a Web Site pass the name of the local report file as a string parameter into the method. This maps the local report to the hard drive file directory path at runtime. Visual Basic Dim reportPath As String end C string reportPath Copyright 2004 Business Objects Page 355 Walkthroughs end For a Windows project concatenate the property with a backslash and the local report file name. This maps the report to the same directory as the Windows