本文介绍了DevExpress Nullrefernce错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我必须将VB.NET中的DevExpress报表实现为C#.

当我调用报告时,它给了我空引用错误(对象引用未设置为对象的实例).我已经转换了代码,并尝试进行故障排除和Google搜索,但没有运气...

Hi There,

I have to implement DevExpress Reporting from VB.NET into C#.

When I call the report it gives me the null reference error (object reference not set to an instance of an object). I''ve converted the code and tried troubleshooting and Googling with no luck...

ERROR LIES ON

InitializeComponent()


上的错误VB代码
printReport.aspx


VB CODE
printReport.aspx

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       Dim Report As New QuoteReport()
       rtool.ReportViewer = ReportViewer1
       ReportViewer1.Report = createReport(Report)        
   End Sub



quoteReport.vb



quoteReport.vb

Public Class QuoteReport

    Inherits DevExpress.XtraReports.UI.XtraReport

#Region " Designer generated code "
 
    Public Sub New()
        MyBase.New()

        'This call is required by the Designer.
        InitializeComponent()
     End Sub
'Required by the Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Designer
    'It can be modified using the Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Dim resourceFileName As String = "QuoteReport.resx"
        Me.Detail = New DevExpress.XtraReports.UI.DetailBand
End Sub




C#代码




C# CODE

protected void Page_Load(object sender, EventArgs e)
        {
            Report_P_O Report_PO_1 = new Report_P_O();
            rtool.ReportViewer = ReportViewer1;
            ReportViewer1.Report = Create(Report_PO_1);
        }





public class Report_P_O : DevExpress.XtraReports.UI.XtraReport
    {
        #region Designer_generated_code

        public Report_P_O()
        {
            InitializeComponent();
        }
    } 
private System.ComponentModel.IContainer components;
              [System.Diagnostics.DebuggerStepThrough()]

       public void InitializeComponent()
       {
           string resourceFileName = "QuoteReport.resx";
           this.Detail = new DevExpress.XtraReports.UI.DetailBand();
       }
}

推荐答案



这篇关于DevExpress Nullrefernce错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 12:18