Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6124969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:11:39+00:00 2026-05-23T16:11:39+00:00

I use crystal report to implement reporting in my c# windows application.I create a

  • 0

I use crystal report to implement reporting in my c# windows application.I create a form to show print preview of Report.I use following code to show preview:

private ReportDocument _reportDocument;
public CrystalReportPrintPreviewForm(ReportDocument reportDocument)
{
    InitializeComponent();

    _reportDocument = reportDocument;
}
private void CrystalReportPrintPreviewForm_Load(object sender, EventArgs e)
{
    if(_reportDocument!=null)
    crystalReportViewer1.ReportSource = _reportDocument;
}

And also i use following code to send ‘ReportDocument’ to this form and show it:

ReportDocument reportDocument = new ReportDocument();
reportDocument.Load(Application.StartupPath + "\\Reports\\WorkGroupReport.rpt");
kargarBandarDataset.WorkGroup.DefaultView.RowFilter = workGroupBindingSource.Filter;
reportDocument.SetDataSource(kargarBandarDataset.WorkGroup.DefaultView.ToTable());
reportDocument.SetParameterValue("CurrentDate",shamsi.ShamsiDate());

CrystalReportPrintPreviewForm crystalReportPrintPreview = new CrystalReportPrintPreviewForm(reportDocument);
crystalReportPrintPreview.ShowDialog();

Sometimes I get NullReferenceException error message in the following line of Code:

crystalReportPrintPreview.ShowDialog();

How Can i solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:11:39+00:00Added an answer on May 23, 2026 at 4:11 pm

    There is no exact answer of how to handle NullReferenceException. Make sure that you enabled “cathching” of thrown expections in VS (Debug->Exception mark Common Language Runtime) find the place where expection if thrown and try to undestand the reasons.

    Also, try to get as much more information from .Message property of Exception.

    Typically NullReference caused by some null arguments submitting to method or constructor of class. Try to debug and see what you passing to object that throws an exception;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have windows application in which i am using crystal report. i use to
My team member not supporting to use Crystal report in asp.net web application. specially
I want to create a crystal report in asp.net with c# use through parameterized
I want design and use reports for my .NET windows application. I use Crystal
I have an asp.net (2.0) page with a crystal report viewer. I use the
I'm converting all of our Crystal Reports to use a home-built reporting system. Essentially,
I have problem with !IspostBack i'm working with crystal report and i use (if
I'm fairly new to Crystal reports and use Crystal Reports 2008 for our reporting
This page I use crystal report to generate a report, but if 10 user
I have this crystal report, and I want to be able to use it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.