日期:2014-05-19  浏览次数:20827 次

诚惶诚恐的问个问题 ....
谁有   winform   中   reportviewer   的使用实例呀,谢谢了?


vs2005   +   sql2000   ...

------解决方案--------------------
汗。。要实例的帖子一般都很少人回。。。Goole找找。

------解决方案--------------------
请搜索。一般都找的到。具体问题这里发帖。
------解决方案--------------------
看MSDN WebCast 跟我一起学VS05(16):Crystal Report篇之概述
------解决方案--------------------
请参考:
DataGridView Printer
http://blog.csdn.net/LeoMaya/archive/2007/03/20/1535322.aspx

我一直在用这个作为DataGridView的Printer
------解决方案--------------------
public class Salary : System.Windows.Forms.Form
{
private CrystalDecisions.Windows.Forms.CrystalReportViewer RptView_Salary;
/// <summary>
/// 設計工具所需的變數。
/// </summary>
private System.ComponentModel.Container components = null;

private dsSalary mySalary;
private string _Company=string.Empty;
private string _UserName=string.Empty;
private int selectedIndex = -1;

public Salary(dsSalary myds,string Company,string UserName)
{
InitializeComponent();

mySalary=myds;
_Company=Company;
_UserName=UserName;

Load_Report();
}

public Salary(dsSalary myds,int Index)
{
InitializeComponent();
mySalary=myds;
selectedIndex = Index;
Load_Report(myds);
}

public Salary(dsSalary myds,string Company,string UserName,int Index)
{
InitializeComponent();
mySalary=myds;
_Company=Company;
_UserName=UserName;
selectedIndex = Index;
Load_Report();
}
/*....
....*/
private void Load_Report()
{
switch(selectedIndex)
{
case 1:
rptDeptSalaryList myRptDeptSalaryList=new rptDeptSalaryList();
myRptDeptSalaryList.SetParameterValue( "Company ",_Company);
myRptDeptSalaryList.SetParameterValue( "UserName ",_UserName);
myRptDeptSalaryList.SetDataSource(mySalary);
RptView_Salary.ReportSource=myRptDeptSalaryList;
break;

case 2:
rptDeptSalary myRptDeptSalary=new rptDeptSalary();
myRptDeptSalary.SetParameterValue( "Company ",_Company);
myRptDeptSalary.SetParameterValue( "UserName ",_UserName);
myRptDeptSalary.SetDataSource(mySalary);
RptView_Salary.ReportSource=myRptDeptSalary;
break;

default:
rptSalary myRptSalary=new rptSalary();
myRptSalary.SetParameterValue( "Company ",_Company);
myRptSalary.SetParameterValue( "UserName ",_UserName);
myRptSalary.SetDataSource(mySalary);
RptView_Salary.ReportSource=myRptSalary;
break;
}
}

private void Load_Report(dsSalary myds)
{
switch(selectedIndex)
{
case 3:
rptSalaryBill myRptSalary = new rptSalaryBill();
myRptSalary.SetDataSource(mySalary);
RptView_Salary.ReportSource = myRptSalary;
break;

case 4:
rptSalarySimple myRptSalarySimple = new rptSalarySimple();
myRptSalarySimple.SetDataSource(mySalary);
RptView_Salary.ReportSource = myRptSalarySimple;
break;
}
}

private void RptView_Salary_ReportRefresh(object source, CrystalDecisions.Windows.Forms.ViewerEventArgs e)