Click here to Skip to main content
15,889,664 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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 CODE
printReport.aspx
VB
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
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# CODE
C#
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);
        }


C#
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();
       }
}
Posted

In case others encounter the same,

Make sure your designer is correct and that other controls are not overlapping each other
 
Share this answer
 
Check that rtool and ReportViewer1 are not null.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900