Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
NullReferenceException in report.Print()
posted

Trying to print XamDataGrid using sample code provided by the Feature browser.   Get a nullreference exception 4 layers into the infragistics package...

 StackTrace:
       at Infragistics.Windows.Reporting.Report.CreateAndInitializePrintDialog()
       at Infragistics.Windows.Reporting.Report.InitializeReport(Boolean showPrintDialog)
       at Infragistics.Windows.Reporting.Report.Print(Boolean showPrintDialog, Boolean showReportProgressControl, FrameworkElement reportProgressControlOwnedElement)
       at Infragistics.Windows.Reporting.Report.Print(Boolean showPrintDialog, Boolean showReportProgressControl)
       at Ability.PolicyAdmin.WPF.Views.PolicyPaymentListView.Button_Click(Object sender, RoutedEventArgs e) in C:\Visual Studio Projects 2008\PolicyAdmin20\Ability.PolicyAdmin.WPF\Views\PolicyPaymentListView.xaml.cs:line 60

Attempt to use demo in Feature Browser also results in failure of browser.    Software is working on XP workstations in this office, but not on this one (Vista).

Anyone have any ideas????

 

  • 4850
    Suggested Answer
    Offline posted

    I took a look at the code and it is making an bad assumption that a PrintDialog will not return null for its PrintQueue property.

    However, if you don't have any printers installed it will return null.

    I'll enter a bug for this but in the meantime you should be able to test for this situation by creating a new System.Windows.Controls.PrintDialog. If its PrintQueue property returns null then don't call the Report.Print method.