This message was discovered on microsoft.public.dotnet.general.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
| komisacroS (VIP) |
I've made a simple program that reads some information from some html files and prints the result (a text) on the printer. The problem is when it tries to print the text. I've used VS Enterprise Architect (the 1st version I think) with .NET Framework v.1.0, installed on Win2000 OS.
The program works just fine on the system I've created it, but if I copy it on a Win98 OS (on which I have the same version of .NET Framework installed) it crashes.
The program has a Form with a PrintPreviewController and it crashes when the method ShowDialog() of this form is executed the error message in this case is:
"System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Forms.PrintPreviewControl.CalculatePageInfo() at System.Windows.Forms.Control.InvokeMarshaledCallbacks()"
If I take out the Form with the PrintPreviwCOntroller and I call PrintDocument.Print() when a button is pressed (from another form) I get the error message: "System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Forms.BackgroundThread.UpdateLabel() at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPage(PrintDocument document, PrintPageEventArgs e) at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document) at System.Drawing.Printing.PrintController.Print(PrintDocument document) at System.Drawing.Printing.PrintDocument.Print() at Ordonator.Printer.Print(String[] lin, Form parent) at Ordonator.FOrdonator.button4_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.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)"
I think that is the same error because the PrintControllerPreview uses the Print method from the PrintDocument.
The strange thing is that this error doesn't occur all the time on the Win98 OS (never on the Win2000) and more often it occurs when a dot matrix printer is the default printer of the system. So, from time to time the program works on the Win98 too. I've tried to run the program on another system with Win98 OS, it crashed but there was another exception: System.ArithmeticException: Overflow or underflow in the arithmetic operation. at System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont) at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet) at Ordonator.PrinterDialog.InitializeComponent() at Ordonator.PrinterDialog..ctor(PrintDocument pd, Printer pr) at Ordonator.Printer.Print(String[] lin, Form parent) at Ordonator.FOrdonator.button4_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.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)
I hope that you can help me.
If you want you can find the program at: http://www.scs.ubbcluj.ro/~cf29359/Programe/Ordonator/Ordonator.zip and the html files that it reads at http://www.scs.ubbcluj.ro/~cf29359/Programe/Ordonator/exHtml.zip The GUI is in romanian, but is easy to use press the only active button then select some html file from exHtml.zip and then press "ORDONEAZA" button. The error occurs when you try to print the result pressing "Listeaza rezultat".
Thank you for your time.
|
|
| |
| |
| Stu Smith |
"komisacroS" <Click here to reveal e-mail address> wrote in message news:Click here to reveal e-mail address... > I've made a simple program that reads some information from some html files > and prints the result (a text) on the printer. The problem is when it tries [Original message clipped]
nt document, PrintPageEventArgs e) [Original message clipped]
I've seen the second trace (overflow/underflow) before on a Win98 machine. We traced the issue to differences in printer driver. Can't remember the exact details, but it was one particular printer, and one particular version of the printer driver. You could try looking for a newer (or older) version of the printer driver, or changing between the manufacturer one and the MS one.
There's quite a bit of info on Google Groups, eg:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=022401c340d5%24bbd954e0%24a501280a%40phx.gbl&rnum=1&prev=/groups%3Fq%3Doverflow%2520underflow%2520Printer%2520Dialog%26hl%3Den%26lr%3D%26ie%3DUTF-8%26sa%3DN%26tab%3Dwg
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=416d01c2b9ea%24dea0c840%2489f82ecf%40TK2MSFTNGXA01&rnum=3&prev=/groups%3Fq%3Doverflow%2520underflow%2520Printer%2520Dialog%26hl%3Den%26lr%3D%26ie%3DUTF-8%26sa%3DN%26tab%3Dwg
(watch that wrapping).
Stu
|
|
| |
| |
| komisacroS (VIP) |
Thank you for your post. I have read the posts indicated by you and I have followed the indications given there but it didn't solve my problem. I thing that my problem is different form the one discused in that posts. I have mentioned in my first post that only on another system (where there is a HP printer) I recieve the overflow/underflow error. After I modified my program folowing that indications I recieve only the first 2 errors on any Win98 system with HP, Epson or Lexmark printers. So, I thing I solved only the problem regarding HP printers.
"Stu Smith" wrote:
[Original message clipped]
|
|
| |
|
|
|
|
|
|