<small id='txs6P'></small><noframes id='txs6P'>

        <i id='txs6P'><tr id='txs6P'><dt id='txs6P'><q id='txs6P'><span id='txs6P'><b id='txs6P'><form id='txs6P'><ins id='txs6P'></ins><ul id='txs6P'></ul><sub id='txs6P'></sub></form><legend id='txs6P'></legend><bdo id='txs6P'><pre id='txs6P'><center id='txs6P'></center></pre></bdo></b><th id='txs6P'></th></span></q></dt></tr></i><div id='txs6P'><tfoot id='txs6P'></tfoot><dl id='txs6P'><fieldset id='txs6P'></fieldset></dl></div>
      1. <tfoot id='txs6P'></tfoot>
          <bdo id='txs6P'></bdo><ul id='txs6P'></ul>
        <legend id='txs6P'><style id='txs6P'><dir id='txs6P'><q id='txs6P'></q></dir></style></legend>

        在 Winform 中打开水晶报表

        Open Crystal Report in Winform(在 Winform 中打开水晶报表)
        <tfoot id='AEB7q'></tfoot>

              <tbody id='AEB7q'></tbody>

            <i id='AEB7q'><tr id='AEB7q'><dt id='AEB7q'><q id='AEB7q'><span id='AEB7q'><b id='AEB7q'><form id='AEB7q'><ins id='AEB7q'></ins><ul id='AEB7q'></ul><sub id='AEB7q'></sub></form><legend id='AEB7q'></legend><bdo id='AEB7q'><pre id='AEB7q'><center id='AEB7q'></center></pre></bdo></b><th id='AEB7q'></th></span></q></dt></tr></i><div id='AEB7q'><tfoot id='AEB7q'></tfoot><dl id='AEB7q'><fieldset id='AEB7q'></fieldset></dl></div>
              <legend id='AEB7q'><style id='AEB7q'><dir id='AEB7q'><q id='AEB7q'></q></dir></style></legend>
                <bdo id='AEB7q'></bdo><ul id='AEB7q'></ul>

                  <small id='AEB7q'></small><noframes id='AEB7q'>

                • 本文介绍了在 Winform 中打开水晶报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我创建了一个水晶报表,然后在创建它之后,我创建了一个 winform,我在其中导入了水晶报表库(以代码显示)并使用报表查看器查看报表,但我无法查看报告,代码,我是 Crytal Reports 的新手,我所做的代码是:

                  I've created a crystal report then after creating it, I've created a winform where I've import crystal report library (shown in code) and used a report viewer to view the report but i not able to view the report, the code, i am new with Crytal Reports, the code I've done is :

                  代码:

                  using System;
                  using System.Collections.Generic;
                  using System.ComponentModel;
                  using System.Data;
                  using System.Drawing;
                  using System.Linq;
                  using System.Text;
                  using System.Windows.Forms;
                  using CrystalDecisions.CrystalReports.Engine;
                  
                  namespace InventorySoftware
                  {
                      public partial class Form1 : Form
                      {
                          public Form1()
                          {
                              InitializeComponent();
                          }
                  
                          private void Form1_Load(object sender, EventArgs e)
                          {
                  
                              this.reportViewer1.RefreshReport();
                  
                  
                  
                          }
                  
                          private void button1_Click(object sender, EventArgs e)
                          {
                              //string ReportSources = "";
                              ReportDocument cryRpt = new ReportDocument();
                              cryRpt.Load("C:\Users\Ahsan\Desktop\PROJECT INVENTORY SOFTWARE\InventorySoftware\InventorySoftware\CrystalReport1.rpt");
                              reportViewer1.ReportSource = cryRpt;
                              reportViewer1.Refresh();
                  
                          }
                      }
                  }
                  

                  它在 reportViewer1.ReportSource = cryRpt; 给出错误,错误是

                  it's giving error at reportViewer1.ReportSource = cryRpt; and the error is

                  Error   1   'Microsoft.Reporting.WinForms.ReportViewer' does not contain a definition for 'ReportSource' and no extension method 'ReportSource' accepting a first argument of type 'Microsoft.Reporting.WinForms.ReportViewer' could be found (are you missing a using directive or an assembly reference?) C:UsersAhsanDesktopPROJECT INVENTORY SOFTWAREInventorySoftwareInventorySoftwareForm1.cs  34  27  InventorySoftware
                  

                  推荐答案

                  您为 Crystal Reports 使用了错误的类/控件.

                  You're using the wrong classes/controls for Crystal Reports.

                  在表单上放置一个 CrystalReportViewer 控件.尽管使用更高版本的 Visual Studio,您必须 下载单独,它仍然是随 VS2008 提供的.

                  Place a CrystalReportViewer control on your form. Although with later versions of Visual Studio you have to download it separately, it was still shipped with VS2008.

                  如果您在工具箱中没有看到它,请右键单击工具箱中的任意位置,然后单击选择项目...".

                  If you don't see it in your toolbox, right-click anywhere in your toolbox and click "Choose Items...".

                  检查并按 OK 后,它应该被添加到您的工具箱中.删除您现有的报表控件并将水晶报表查看器放在表单上:

                  After checking it and pressing OK, it should be added to your toolbox. Remove your existing report control and drop a crystal report viewer on the form:

                  当您将查看器放在项目上时,必要的水晶参考将被添加到您的项目中.

                  The necessary crystal references will be added to your project when you drop the viewer on it.

                  将此 using 指令添加到代码隐藏的顶部:

                  Add this using directive to the top of your code-behind:

                  using CrystalDecisions.CrystalReports.Engine;
                  

                  然后将您的报告加载到查看器中:

                  Then load your report into the viewer:

                  var cryRpt = new ReportDocument();
                  cryRpt.Load(@"C:UsersAhsanDesktopPROJECT INVENTORY SOFTWAREInventorySoftwareInventorySoftwareCrystalReport1.rpt");
                  crystalReportViewer1.ReportSource = cryRpt;
                  crystalReportViewer1.Refresh();
                  

                  将目标框架从 .NET Framework 4 Client Profile 更改为 .NET Framework 4:

                  Change the targeted framework from .NET Framework 4 Client Profile to .NET Framework 4:

                  这篇关于在 Winform 中打开水晶报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
                  Parameter count mismatch with Invoke?(参数计数与调用不匹配?)
                  How to store delegates in a List(如何将代表存储在列表中)
                  How delegates work (in the background)?(代表如何工作(在后台)?)
                  C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)
                  Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)
                  <i id='ALXrK'><tr id='ALXrK'><dt id='ALXrK'><q id='ALXrK'><span id='ALXrK'><b id='ALXrK'><form id='ALXrK'><ins id='ALXrK'></ins><ul id='ALXrK'></ul><sub id='ALXrK'></sub></form><legend id='ALXrK'></legend><bdo id='ALXrK'><pre id='ALXrK'><center id='ALXrK'></center></pre></bdo></b><th id='ALXrK'></th></span></q></dt></tr></i><div id='ALXrK'><tfoot id='ALXrK'></tfoot><dl id='ALXrK'><fieldset id='ALXrK'></fieldset></dl></div>
                  1. <small id='ALXrK'></small><noframes id='ALXrK'>

                        <bdo id='ALXrK'></bdo><ul id='ALXrK'></ul>
                          <tfoot id='ALXrK'></tfoot>
                              <tbody id='ALXrK'></tbody>

                          1. <legend id='ALXrK'><style id='ALXrK'><dir id='ALXrK'><q id='ALXrK'></q></dir></style></legend>