.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Error/Crash While Printing

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :.NET Framework
Below code show how i have initiated the Oritn Dialog using comdlg32.dll. PRINTDLG _pd = new PRINTDLG();             _pd.lStructSize = Marshal.SizeOf(_pd);             _pd.hwndOwner = this.Parent;             // Pass the handles to the DEVMODE and DEVNAMES structures from the             // printer settings object to the PRINTDLG so that the current             // printsettings are displayed in the print setup dialog.             _pd.hDevMode = printerSettings.GetHdevmode();             _pd.hDevNames = printerSettings.GetHdevnames();             // indicates that only the print setup dialog should be shown.             _pd.Flags = PrintFlag.PD_ENABLEPRINTHOOK | PrintFlag.PD_NOPAGENUMS | PrintFlag.PD_USEDEVMODECOPIESANDCOLLATE;             // set print to file checkbox visible/not visible         

View Complete Post

More Related Resource Links

Sporadic .NET application crash with "Fatal Execution Engine Error"

I have a .NET application that runs for several hours.  It is a multi-threaded app that does some calculations and saves the results to the database.   On one machine in particular, it has been crashing recently with the following exception recorded in the Event Log: .NET Runtime version 2.0.50727.4206 - Fatal Execution Engine Error (6C9D7B6E) (80131506) Faulting application AnalyzerConsole.exe, version, time stamp 0x4c76d28b, faulting module mscorwks.dll, version 2.0.50727.4206, time stamp 0x4bf4c6a7, exception code 0xc0000005, fault offset 0x0011627d, process id 0x%9, application start time 0x%10. Sometimes it runs for hours without crashing, but usually it will crash eventually. I have captured a dump, and this is the call stack: > ntdll.dll!_DbgBreakPoint@0()   mscorwks.dll!WatsonLastChance()  + 0x133 bytes   mscorwks.dll!EEPolicy::LogFatalError()  + 0x23c bytes   mscorwks.dll!EEPolicy::HandleFatalError()  + 0x47 bytes   mscorwks.dll!CLRVectoredExceptionHandlerPhase3()  + 0x10dae2 bytes   mscorwks.dll!CLRVectoredExceptionHandlerPhase2()  + 0x20 bytes   mscorwks.dll!CLRVectoredExceptionHandler()  + 0xb7 bytes   mscorwks.dll!CPFH_RealFirstPassHandler()  + 0x8ac bytes   mscorwks.dll!_COMPlusFrameHandler()  + 0xb9 bytes   ntdll.d

"An error occurred during printing. (0x8000405)" eror - reporting services issue

We are getting this error: "An error occurred during printing. (0x8000405)" from time to time - 70% of the time when we are trying to use a printer button within report manager. It happens if we preview report or just print it. We noticed if we restart RS services, the error will stop for a little bit and then starts again. We don't print that much and it will come back after just a few reports printed. Let me know if you had a similar issue. thanks!

How to Suppress the JavaScript error tht pops up while printing the WebBrowser content??

Hi All, In my windows application I'm loading more than 100 urls in my web browser control one by one in a for loop and need to print them programatically after each URL gets loaded . But, I keep getting the Javascript error for so many URLs. I'm not sure why this error keep coming. Can anyone help me on how to suppress the javascript error through code and proceed. Thank you.

Error on Printing

I got the below exception on Calling print as in below code PrintController oPrintCtrl = new StandardPrintController(); if (this.ShowStatusDialog) { this.Document.PrintController = new PrintControllerWithStatusDialog( oPrintCtrl, TITLE); } this.Document.Print(); At the OnPrintPage event , IntPtr hDC = e.Graphics.GetHdc(); Graphics gr = this.PrinterSettings.CreateMeasurementGraphics(); float dpiX = gr.DpiX; float dpiY = gr.DpiY; int offsetx, offsety; int horzres, vertres; int physicalwidth, physicalheight; offsetx = GetDeviceCaps(hDC, PHYSICALOFFSETX); offsety = GetDeviceCaps(hDC, PHYSICALOFFSETY); horzres = GetDeviceCaps(hDC, HORZRES); vertres = GetDeviceCaps(hDC, VERTRES); physicalwidth = GetDeviceCaps(hDC, PHYSICALWIDTH); physicalheight = GetDeviceCaps(hDC, PHYSICALHEIGHT); Left = (int)Math.Ceiling((float)offsetx * 100.0F / dpiX); Top = (int)Math.Ceiling((float)offsety * 100.0F / dpiY); Right = (int)Math.Ceiling((float)(physicalwidth - horzres - offsetx) * 100.0F / dpiY); Bottom = (int)Math.Ceiling((float)(physicalheight - vertres - offsety) * 100.0F / dpiY); e.Graphics.ReleaseHdc(hDC); if (!this.DefaultPageSettings.Landscape) { PageWidth = e.PageSettings.PrintableArea.Width; PageHeight = e.PageSettings.PrintableA

SQL Server 2K5 - INSERT INTO Script crash with no specific error

Hi, I need to run a sql statement that insert data into a table. I have about 14000 line to insert. In SQL Management studio, I did a script like that : INSERT INTO [TableName] (Field1,fireld2,field3,...) Select 'Values1','Values2','Value3',.... UNION ALL Select 'Values1','Values2','Value3',.... UNION ALL Select 'Values1','Values2','Value3',.... UNION ALL . . . When I try to insert around 1000 line and more, the script crash with no specific error code or message. I only see the message in the status bar saying, the script ended with error. Is there a way to avoid having that error ? ThanksRichard Martin Web Developer / BI Developer

Error to watch ThreadStore in Crash Dump


I have a Website running on a server with Windows 2008 SP2 64Bit and a website running on Framework 3.5. Net
After install updates and the Framework 4.0 on some servers I can't examine the managed threads running in my application.

The error message is as follows:
Failed to request ThreadStore

Obs:The version that runs the website remains the same.
My site is still running normally.

I have some servers that update was not made and I can analise it normally

I've tried loading other Symbols, another version of SOS.dll but nothing solves my problem.

Anyone have any idea what might be happening with my application?

Bluetooth Printing Guide using Windows Mobile Pocket Pc

FieldSoftware Products printing products use the Bluetooth "Serial Port Profile" (SPP). Unfortunately, there is no standard method to find your Bluetooth printer and begin printing... each device contains a Bluetooth stack/driver that determines the steps. There are two main stacks currently available... one from Microsoft and one from WIDCOMM/Broadcom. Below are step-by-step instructions for printing with the Microsoft and WIDCOMM stacks. Note that these may change for different versions of the Bluetooth stacks or for different manufacturers. Consult the documentation for your device for specific details on your device.

Identifying your device''s Bluetooth stack: There is no sure steps to identify a Bluetooth stack on a device. Below are steps for identifying current WIDCOMM and Microsoft stacks at the time this page is published. Note that these may not identify earlier or later versions of the same BT stacks.

IsapiModule Error 500 Issue


I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:


CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"


Handling 404 page not found with Error page



      How do i handle 404 page not found?

Inserting personal error message in ValidationSummary



I am creating a web form that requires a lot of validation. I use many of the validation control in asp.net already like RequiredFieldValidator and CompareValidator. 

My Problem: after my custom validation for the value entered return an error message, and I pressed enter key when the field is empty, my custom error message is overlapped by my ValidationSummary. 

Setting my custom error to visible = false on button click also does not seem to work as it requires for me to enter the value first.

This made me think, is there a way to insert my custom validation inside the ValidationSummary as an error message like for other validation control?

Thanks in advance

ASP.net Ajax TabContainer -- Printing All tabs



Can  anyone help me with this?. I want to print all the tabs in ajax tab container. The tab container has around 10 tabs. I dont want to goto each tab and print the page. Instead is there any way by which I can tweek the print.css file to print all the tabs at a single stretch?.  So that I will get all the contents of the tab in single print.  Is there any other way in which I can print all the tabs all together?.

Thanks in Advance...


Sys.Net.WebServiceFailedException: The server method '' failed with the following error:



Let's say we have 2 time consuming functions, aaa and aaa1 inside a aspx page.

        public static string aaa(int i)
            return i.ToString();

        public static string aaa1(int i)
            return i.ToString();



        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        <span id="displayspan"></span>
        <br />
        <input type="button" value=

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo

Type or namespace error.


A couple of days ago I started getting an unusual behavior when compiling Website projects. I have referenced class libraries added to my bin folder that are also correctely referenced in using statements in my aspx.cs code behind. When I compile, I get the 

Error 4 The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?) C:\Dev\Fiscal_Portal\Implementation\FMS Portal Site_new\App_Code\BLL\DataTables.cs 1 7 C:\...\FMS Portal Site_new\

The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?)

error message that would typically be received when the dll has not been added as a reference or added in a using statement.

I can eliminate the error by adding an


HTTP Error 403 - Forbidden


(VB Express website directed me to ASP.NET Web Services which in turn redirected me to this forum).

 Hopefully someone can help me here...... 

I am using VIsual Web Developer and downloaded the small business application to use as a starting point to help my wife get a website up for her small business. When I load the application, I can F5 and it runs fine but as soon as I make any modification to the app and hit F5, I get the HTTP Error 403 - Forbidden when it tries to show the website.

I notice a pop up that occurs when I run that allows me to choose the link for my app and it displays correctly (I close the webpage that has the error on it).

This seems like a pain, is there a setting I'm missing - I would think that this should "just work".

What's up?????



Printing resource files



I have some resource files for localization and would like to print them. When I try to print them in Visual Studio (with File -> Print...) the button is disabled. Does anyone know how to print them? (Without copying each into word or excel)

Thanks and regards,

Webmatrix error


When i try to do anything in webmatrix it shuts down.   i get this error in the log

pplication: WebMatrix.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: Unrecoverable system error.
   at System.Environment.FailFast(System.String)
   at MS.Internal.Invariant.FailFast(System.String, System.String)
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend