Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# VB.NET DevExpress
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
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
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
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();
       }
}
Posted 27-Sep-12 1:30am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

In case others encounter the same,
 
Make sure your designer is correct and that other controls are not overlapping each other
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Check that rtool and ReportViewer1 are not null.
  Permalink  

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



Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 7 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100