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 7806371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:30:48+00:00 2026-06-02T02:30:48+00:00

I am using Crystl Report XI and WFP viewer to view the report on

  • 0

I am using Crystl Report XI and WFP viewer to view the report on a window.

I am trying to refresh my Crystal Report using the RefreshReport() method. But it gets a NULLReferanceException at the line Me.irRapportViewer.ViewerCore.RefreshReport().

If i remove this line the report gets loaded but its not the latest one. To get the latest one i have to click on the Refresh button on the viewer. Thats why I need to refresh it from the code.

Bellow is the code. I can’t find what I am doing wrong.

Private Sub Window_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded

        Dim cryRpt As New ReportDocument()
        Dim crtableLogoninfos As New TableLogOnInfos()
        Dim crtableLogoninfo As New TableLogOnInfo()
        Dim crConnectionInfo As New ConnectionInfo()
        Dim CrTables As Tables

        Dim startupPath As String = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName
        cryRpt.Load(startupPath & "\Reports\IrReport2.rpt")

        Dim connectionString As String = ConfigurationManager.ConnectionStrings("ReportConnStr").ConnectionString
        Dim conn = New SqlConnectionStringBuilder(connectionString)

        crConnectionInfo.ServerName = conn.DataSource
        crConnectionInfo.DatabaseName = conn.InitialCatalog
        crConnectionInfo.UserID = conn.UserID
        crConnectionInfo.Password = conn.Password

        CrTables = cryRpt.Database.Tables
        For Each CrTable As CrystalDecisions.CrystalReports.Engine.Table In CrTables
            crtableLogoninfo = CrTable.LogOnInfo
            crtableLogoninfo.ConnectionInfo = crConnectionInfo
            CrTable.ApplyLogOnInfo(crtableLogoninfo)
        Next

        Me.irRapportViewer.ViewerCore.ReportSource = cryRpt
        Me.irRapportViewer.ViewerCore.ReuseParameterWhenRefresh = True
        Me.irRapportViewer.ViewerCore.RefreshReport()

    End Sub

The XAML is as bellow

<Window x:Class="IrRptWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cr="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer"
    Title="IrRptWindow" Height="700" Width="800" WindowStartupLocation="CenterScreen">
    <Grid>
        <cr:CrystalReportsViewer Name="irRapportViewer" ToggleSidePanel="None"></cr:CrystalReportsViewer>
    </Grid>
</Window>
  • 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-06-02T02:30:50+00:00Added an answer on June 2, 2026 at 2:30 am

    After hours of looking here and there finally I thought why not try refreshing the ReportDocument and amazingly it works. I tried cryRpt.Refresh() before setting the report to the viewer. Following are the modified last three lines of my window load event.

    cryRpt.Refresh()
    Me.irRapportViewer.ViewerCore.ReportSource = cryRpt
    
    'Me.irRapportViewer.ViewerCore.ReuseParameterWhenRefresh = True (No Need)
    'Me.irRapportViewer.ViewerCore.RefreshReport() (No Need)
    

    Comments are appreciated under this answer.

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

Sidebar

Related Questions

I am using the Crystal Report Viewer in an ASP.NET application. On the viewer
I am using crystal report for printing . But after hosting in the server
I was trying to filter the crystal report by using the IN operator like
Using Crystal Report 8.5 How to skip blank pages? I want to skip blank
Using Crystal Report 8.5 Generating a report from table1 My Crystal Report Output ID
Using Crystal Report 7 ID Value 001 100 002 200 003 400 004 500
using crystal report 7 Single report (no sub report added, group by id) ID
Using Crystal Report 7 Single report (not sub report added, group by id) ID
using crystal report 7 ID Value total 001 100 2000 002 300 1000 003
Using Crystal Report 7 ID Name 001 Raja 002 Vijay 003 Suresh 004 Mahes

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.