使用5种不同的方法加载水晶报表(Windows 窗体)

王朝system·作者佚名  2006-01-08
宽屏版  字体: |||超大  

1、代码下载:http://support.crystaldecisions.com/communityCS/FilesAndUpdates/vbnet_win_simplepreviewreport.exe.asp?recDnlReq=Record&dnlPath=vbnet_win_simplepreviewreport.exe

2、用作 viewer.reportsource 的5种类型的报表:

- 使用 Report 名 (通过文本路径)

- 使用 Report 对象 (通过文本路径)

- 使用非类型的 Report 组件 (通过文本路径和 ReportDocument reportdocument1)

- 使用 Report 对象 (通过已添加到项目的报表文件,如:World Sales Report.rpt)

- 使用强类型的 Report 组件()(通过 ReportDocument world_Sales_Report1)

注:Report 组件即“工具箱”-〉“组件”-〉“ReportDocument”

3、代码简介:

- 使用 Report 名 (通过文本路径)

CrystalReportViewer1.ReportSource = "C:\Crystal\crnet\vbnet_win_simplepreviewreport\World Sales Report.rpt"

'--------------------------------------------------------------------

- 使用 Report 对象 (通过文本路径)

Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument()

crReportDocument.Load("C:\Crystal\crnet\vbnet_win_simplepreviewreport\World Sales Report.rpt")

CrystalReportViewer1.ReportSource = crReportDocument

'--------------------------------------------------------------------

- 使用非类型的 Report 组件 (通过文本路径和 ReportDocument reportdocument1)

Dim reportdocument1 As New CrystalDecisions.CrystalReports.Engine.ReportDocument()

reportdocument1.Load("C:\Crystal\crnet\vbnet_win_simplepreviewreport\World Sales Report.rpt")

CrystalReportViewer1.ReportSource = reportdocument1

'--------------------------------------------------------------------

- 使用 Report 对象 (通过已添加到项目的报表文件,如:World Sales Report.rpt)

CrystalReportViewer1.ReportSource = New World_Sales_Report()

'--------------------------------------------------------------------

- 使用强类型的 Report 组件()(通过 ReportDocument world_Sales_Report1)

CrystalReportViewer1.ReportSource = world_Sales_Report1

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有