I'm trying to Preview before I print and I'm getting this error. Can somebody tell me why.
*** my errorCode:Private Sub Preview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Preview.Click Dim ErrReport As PrintDocument Dim dlgPreview As PrintPreviewDialog ErrReport = New PrintDocument() dlgPreview = New PrintPreviewDialog() AddHandler ErrReport.PrintPage, AddressOf PrintReport dlgPreview.Document = ErrReport dlgPreview.ShowDialog() End Sub
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.PrintPreviewControl.CalculatePageInfo()
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
PrintReport is where the report is created.
Thanks.




Reply With Quote