By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,326 Members | 2,726 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,326 IT Pros & Developers. It's quick & easy.

unhandeled execption in PrintPreview

P: n/a
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.Calculate PageInfo()
at System.Windows.Forms.Control.InvokeMarshaledCallba cks()
************** 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>

--
Max
ma*@m99c.com
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

--
Max
ma*@m99c.com
"max" <xa*******@isomedia.com> wrote in message
news:OX****************@tk2msftngp13.phx.gbl...
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.Calculate PageInfo()
at System.Windows.Forms.Control.InvokeMarshaledCallba cks()
************** 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>

--
Max
ma*@m99c.com

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.