S
shan_chennai
I have a print component that opens up a printpreviewdialog and paints
all the controls.
Now when i click the Print, after setting Microsoft Office Document
Image Writer as default printer, the Save As dialog for saving the mdi
file is opened. When i click on save, there is no problem. But when i
click on Cancel, i get a unhandled exception as shown below.
I am able to catch this exception in code when i run the solution from
VS .net. But the unhandled exception occurs when i run the .exe
directly.
The code i use is as follows..
PrintPreviewDialog oPrintPrevDialog = new PrintPreviewDialog();
oPrintPrevDialog.Document = _oPrintDocument;
oPrintPrevDialog.UseAntiAlias = true;
oPrintPrevDialog.ClientSize = new Size(800,600);
if(oSettings==null)
oSettings=new PrinterSettings();
oPrintPrevDialog.ShowDialog();
.....
private void _oPrintDocument_PrintPage..
//
}
oPrintDialog.PrinterSettings.FromPage = 1;
oPrintDialog.PrinterSettings.ToPage = iPageNumber;
//PrintRange.SomePages;
DialogResult oDialogRes = oPrintDialog.ShowDialog();
if (DialogResult.OK != oDialogRes)
return;
EXCEPTION MESSAGE IS
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ComponentModel.Win32Exception: The operation was canceled by the
user
at
System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument
document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument
document)
at System.Drawing.Printing.PrintDocument.Print()
at System.Windows.Forms.PrintPreviewDialog.ToolBarClick(Object
source, ToolBarButtonClickEventArgs eventargs)
at
System.Windows.Forms.ToolBar.OnButtonClick(ToolBarButtonClickEventArgs
e)
at System.Windows.Forms.ToolBar.WmReflectCommand(Message& m)
at System.Windows.Forms.ToolBar.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
Login
Assembly Version: 1.0.1917.1483
Win32 Version: 1.0.1917.1483
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/Login.exe
----------------------------------------
ControlPlusLibrary
Assembly Version: 1.0.1917.1325
Win32 Version: 1.0.1917.1325
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/ControlPlusLibrary.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/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.573
CodeBase:
file:///c:/winnt/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
UtilityComponent
Assembly Version: 1.0.1917.1401
Win32 Version: 1.0.1917.1401
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/UtilityComponent.DLL
----------------------------------------
FiledExceptions
Assembly Version: 1.0.1806.843
Win32 Version: 1.0.1806.843
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/FiledExceptions.DLL
----------------------------------------
FiledFormsGenerator
Assembly Version: 1.0.1917.1442
Win32 Version: 1.0.1917.1442
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/FiledFormsGenerator.DLL
----------------------------------------
BusinessFacade
Assembly Version: 1.0.1917.1411
Win32 Version: 1.0.1917.1411
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/BusinessFacade.DLL
----------------------------------------
Accessibility
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/accessibility.dll
----------------------------------------
DataAccessFacade
Assembly Version: 1.0.1917.1410
Win32 Version: 1.0.1917.1410
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/DataAccessFacade.DLL
----------------------------------------
FrameworkHelpers
Assembly Version: 1.0.1917.1308
Win32 Version: 1.0.1917.1308
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/FrameworkHelpers.DLL
----------------------------------------
System.EnterpriseServices
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.enterpriseservices/1.0.5000.0__b03f5f7f11d50a3a/system.enterpriseservices.dll
----------------------------------------
BusinessRules
Assembly Version: 1.0.1917.1417
Win32 Version: 1.0.1917.1417
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/BusinessRules.DLL
----------------------------------------
LoggingComponent
Assembly Version: 1.0.1806.842
Win32 Version: 1.0.1806.842
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/LoggingComponent.DLL
----------------------------------------
FiledApplication
Assembly Version: 0.0.0.0
Win32 Version: 0.0.0.0
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/FiledFormsGenerator/CompiledFormDlls/FiledApplication.dll
----------------------------------------
AxInterop.SHDocVw
Assembly Version: 1.1.0.0
Win32 Version: 1.1.0.0
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/AxInterop.SHDocVw.DLL
----------------------------------------
HomePage
Assembly Version: 1.0.1917.1483
Win32 Version: 1.0.1917.1483
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/FiledFormsGenerator/CompiledFormDlls/HomePage.dll
----------------------------------------
Interop.SHDocVw
Assembly Version: 1.1.0.0
Win32 Version: 1.1.0.0
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/Interop.SHDocVw.DLL
----------------------------------------
ProcessGroupPage
Assembly Version: 1.0.1832.35204
Win32 Version: 1.0.1832.35204
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/ProcessGroupPage.DLL
----------------------------------------
Print
Assembly Version: 1.0.1917.1335
Win32 Version: 1.0.1917.1335
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/Print.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.
Can any1 help?
all the controls.
Now when i click the Print, after setting Microsoft Office Document
Image Writer as default printer, the Save As dialog for saving the mdi
file is opened. When i click on save, there is no problem. But when i
click on Cancel, i get a unhandled exception as shown below.
I am able to catch this exception in code when i run the solution from
VS .net. But the unhandled exception occurs when i run the .exe
directly.
The code i use is as follows..
PrintPreviewDialog oPrintPrevDialog = new PrintPreviewDialog();
oPrintPrevDialog.Document = _oPrintDocument;
oPrintPrevDialog.UseAntiAlias = true;
oPrintPrevDialog.ClientSize = new Size(800,600);
if(oSettings==null)
oSettings=new PrinterSettings();
oPrintPrevDialog.ShowDialog();
.....
private void _oPrintDocument_PrintPage..
//
}
oPrintDialog.PrinterSettings.FromPage = 1;
oPrintDialog.PrinterSettings.ToPage = iPageNumber;
//PrintRange.SomePages;
DialogResult oDialogRes = oPrintDialog.ShowDialog();
if (DialogResult.OK != oDialogRes)
return;
EXCEPTION MESSAGE IS
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ComponentModel.Win32Exception: The operation was canceled by the
user
at
System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument
document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument
document)
at System.Drawing.Printing.PrintDocument.Print()
at System.Windows.Forms.PrintPreviewDialog.ToolBarClick(Object
source, ToolBarButtonClickEventArgs eventargs)
at
System.Windows.Forms.ToolBar.OnButtonClick(ToolBarButtonClickEventArgs
e)
at System.Windows.Forms.ToolBar.WmReflectCommand(Message& m)
at System.Windows.Forms.ToolBar.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
Login
Assembly Version: 1.0.1917.1483
Win32 Version: 1.0.1917.1483
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/Login.exe
----------------------------------------
ControlPlusLibrary
Assembly Version: 1.0.1917.1325
Win32 Version: 1.0.1917.1325
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/ControlPlusLibrary.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/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.573
CodeBase:
file:///c:/winnt/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
UtilityComponent
Assembly Version: 1.0.1917.1401
Win32 Version: 1.0.1917.1401
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/UtilityComponent.DLL
----------------------------------------
FiledExceptions
Assembly Version: 1.0.1806.843
Win32 Version: 1.0.1806.843
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/FiledExceptions.DLL
----------------------------------------
FiledFormsGenerator
Assembly Version: 1.0.1917.1442
Win32 Version: 1.0.1917.1442
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/FiledFormsGenerator.DLL
----------------------------------------
BusinessFacade
Assembly Version: 1.0.1917.1411
Win32 Version: 1.0.1917.1411
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/BusinessFacade.DLL
----------------------------------------
Accessibility
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/accessibility.dll
----------------------------------------
DataAccessFacade
Assembly Version: 1.0.1917.1410
Win32 Version: 1.0.1917.1410
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/DataAccessFacade.DLL
----------------------------------------
FrameworkHelpers
Assembly Version: 1.0.1917.1308
Win32 Version: 1.0.1917.1308
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/FrameworkHelpers.DLL
----------------------------------------
System.EnterpriseServices
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.enterpriseservices/1.0.5000.0__b03f5f7f11d50a3a/system.enterpriseservices.dll
----------------------------------------
BusinessRules
Assembly Version: 1.0.1917.1417
Win32 Version: 1.0.1917.1417
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/BusinessRules.DLL
----------------------------------------
LoggingComponent
Assembly Version: 1.0.1806.842
Win32 Version: 1.0.1806.842
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/LoggingComponent.DLL
----------------------------------------
FiledApplication
Assembly Version: 0.0.0.0
Win32 Version: 0.0.0.0
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/FiledFormsGenerator/CompiledFormDlls/FiledApplication.dll
----------------------------------------
AxInterop.SHDocVw
Assembly Version: 1.1.0.0
Win32 Version: 1.1.0.0
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/AxInterop.SHDocVw.DLL
----------------------------------------
HomePage
Assembly Version: 1.0.1917.1483
Win32 Version: 1.0.1917.1483
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/FiledFormsGenerator/CompiledFormDlls/HomePage.dll
----------------------------------------
Interop.SHDocVw
Assembly Version: 1.1.0.0
Win32 Version: 1.1.0.0
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/Interop.SHDocVw.DLL
----------------------------------------
ProcessGroupPage
Assembly Version: 1.0.1832.35204
Win32 Version: 1.0.1832.35204
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/ProcessGroupPage.DLL
----------------------------------------
Assembly Version: 1.0.1917.1335
Win32 Version: 1.0.1917.1335
CodeBase:
file:///C:/Shankar/FileFolder/Framework/FileFolder/FileFolder/Login/bin/Debug/Print.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.
Can any1 help?