I am working on an application which has several reports which are written to disk files and then previewed or printed.
The Print Preview of these reports is working perfectly however when I click the Print icon on the Print Preview toolbar the report fails to actually print.
I guess I a missing something rather fundamental here I would appreciate a sanity check of my code.
Private Sub printPreview(ByVal theTitle As String, ByVal theFile As String)
Dim objPrint As New HSPrinter(theTitle, theFile)
Dim previewDialog As New PrintPreviewDialog
Dim pageSetup As New PageSetupDialog
pageSetup.Document = objPrint.printDocument
Dim dialogResult As DialogResult = pageSetup.ShowDialog
If dialogResult = Windows.Forms.DialogResult.Cancel Then
.Document = objPrint.printDocument
.PrintPreviewControl.Zoom = 0.9
.WindowState = FormWindowState.Maximized
.ShowInTaskbar = True