jamesrhaynes
Programmer
Although all print operations work well in Windows XP, the print preview (and page setup) dialogs crash in Win 98. Its a real system crash (with the fatal error dialog) that ignores all the error traps and leaves the machine locked up. This occures on all 3 of the Win 98 machines that I use for testing.
However, I found that if I first print the document to a real printer then the print preview and print page work fine from then on. Sounds like initialization but I have found nothing that works.
There are really two problems. One is the Print Page and Print Preview dialogs don't work and the other is that the error traps don't work either. My simplest code that don't work is below:
Private Sub menuFilePrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuFilePrintPreview.Click
Try
MainPrintPreviewDialog.Document = MainPrintDocument
MainPrintPreviewDialog.ShowDialog()
Catch ex As Exception
'
End Try
End Sub
Private Sub MainPrintDocument_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles MainPrintDocument.PrintPage
Try
'this prints nothing to eliminate this
'routine as the problem
Exit Try
Catch ex as Exception
'
End try
End sub
Private Sub menuFilePrintDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuFilePrintDisplay.Click
Try
MainPrintDialog.Document = MainPrintDocument
If MainPrintDialog.ShowDialog = DialogResult.OK Then
MainPrintDocument.Print()
End If
Catch ex As Exception
'
End Try
MainPrintDialog.Dispose()
End Sub
However, I found that if I first print the document to a real printer then the print preview and print page work fine from then on. Sounds like initialization but I have found nothing that works.
There are really two problems. One is the Print Page and Print Preview dialogs don't work and the other is that the error traps don't work either. My simplest code that don't work is below:
Private Sub menuFilePrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuFilePrintPreview.Click
Try
MainPrintPreviewDialog.Document = MainPrintDocument
MainPrintPreviewDialog.ShowDialog()
Catch ex As Exception
'
End Try
End Sub
Private Sub MainPrintDocument_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles MainPrintDocument.PrintPage
Try
'this prints nothing to eliminate this
'routine as the problem
Exit Try
Catch ex as Exception
'
End try
End sub
Private Sub menuFilePrintDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuFilePrintDisplay.Click
Try
MainPrintDialog.Document = MainPrintDocument
If MainPrintDialog.ShowDialog = DialogResult.OK Then
MainPrintDocument.Print()
End If
Catch ex As Exception
'
End Try
MainPrintDialog.Dispose()
End Sub