Home All Groups Group Topic Archive Search About

VB.NET : Show print dialog before printing Word object

Author
16 Feb 2006 8:28 AM
rija
Hi all,

I would like to know how can I do to display print dialog so that the
user can choose printer when printing word document object.

Basically, I download rtf document on the HD and open it with VB.NET
then use printout method to print it.

Now, what I want to do is to make the print dialog available.

Thanks in advance

Author
16 Feb 2006 7:28 PM
J-Rod
This is an example of both the OpenFileDialog() and the PrintDialog,
You first choose a file, and then choose the printer.


Dim ofd As New OpenFileDialog()
         If ofd.ShowDialog(Me) Then
          ' Allow the user to select a printer.
          Dim pd As New PrintDialog()
          pd.PrinterSettings = New PrinterSettings()
          If (pd.ShowDialog() = Forms.DialogResult.OK) Then
              ' Print the file to the printer.
          End If
       End If