110,536
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// 设置报表
/// </summary>
private void SetReport()
{
if (reportModel != null)
{
if (ReportSource.Count > 0) ReportSource.Clear();
if (this.reportViewer1.LocalReport.DataSources.Count > 0) this.reportViewer1.LocalReport.DataSources.Clear();
ReportSource.Add(reportModel);
this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("SMAccidentInfo_SimpleReport", ReportSource));
this.reportViewer1.LocalReport.Refresh();
this.reportViewer1.RefreshReport();
}
}
private void tsbPrint_Click(object sender, EventArgs e)
{
try
{
SetReport();
this.reportViewer1.PrintDialog();
}
catch (Exception ex)
{
Sys_Error.WriteError(this, ex);
}
}
捕捉到 System.InvalidOperationException
Message="对象的当前状态使该操作无效。"
Source="Microsoft.ReportViewer.WinForms"
StackTrace:
在 Microsoft.Reporting.WinForms.ReportViewer.PrintDialog()
在 Report.FrmSimpleReport.tsbPrint_Click(Object sender, EventArgs e) 位置