Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vb.net print preview dialog fails in Windows 98

Status
Not open for further replies.

jamesrhaynes

Programmer
Nov 1, 2003
19
0
0
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top