furjaw

When using PrintDialog(), where the user selects which printer to use, is it possible to specify a preview, that is whithout the user having to select preview

Private Sub btnPrintDialog_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnPrintDialog.Click

Dim dlg As New PrintDialog()
dlg.Document = mDoc
If dlg.ShowDialog = DialogResult.OK Then
mDoc.Print()
End If

End Sub



Re: Visual Basic Express Edition Using PrintDialog(), can I specify "Preview"?

element109

Code Snippet

Dim WithEvents dlgPrintPreview As New System.Windows.Forms.PrintPreviewDialog

Dim WithEvents mDoc As New System.Drawing.Printing.PrintDocument

Private Sub PrintWithPreview()

Dim dlg As New PrintDialog()

dlg.Document = mDoc

dlgPrintPreview.Document = mDoc

dlgPrintPreview.ShowDialog()

If dlg.ShowDialog = DialogResult.OK Then

mDoc.Print()

End If

End Sub