unhandeled execption in PrintPreview

M

max

Is this a framework question? vs a VB.Net question?

I'm getting an unhandled exception in oPreview that isn't caught by the
Try. Any ideas on how surround this puppy??

<SNIP>
Dim oPreview As PrintPreviewDialog
....

If oJobReport Is Nothing Then
oJobReport = New PrintDocument
End If
AddHandler oJobReport.PrintPage, AddressOf PrintJobRptPage
AddHandler oJobReport.BeginPrint, AddressOf PrepareJobReport
'AddHandler oJobReport.EndPrint, AddressOf JobReportFini
If bPrintPreview Then
oPreview = New PrintPreviewDialog
oPreview.Document = oJobReport
Try
oPreview.ShowDialog()
Catch ex As Exception
MsgBox("Print Preview Exception" & vbCrLf & ex.ToString())
End Try
....
<SNIP>

Output of the details of the exception, happened on the .ShowDialog() not in
the Catch...
I don't understand the configuration information on the bottom on output.
This is being run in Debug mode, but all you can do is Continue or Ignore.

<OUTPUT from error>

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** 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()


************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
rrprt_cl
Assembly Version: 1.0.1821.16933
Win32 Version: 1.0.1821.16933
CodeBase:
file:///C:/Documents%20and%20Settings/Max/My%20Documents/Visual%20Studio%20Projects/rrprt/rrprt_cl/bin/rrprt_cl.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase:
file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
Accessibility
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/accessibility.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.

<END of OUTPUT from error>
 
M

max

Well, it has something to do with:
If oPrinterSetting Is Nothing Then
oPrinterSetting = New PrinterSettings
End If

I don't see how they got associated, but with prior to the
printPreview.showdialog it begins to work. :)
I wonder why.

Thanks,
max
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top