Need to print Checks on a specific printer without using a Dialog Box. We
don't want users to change where the print job goes. How can I select a
specific printer by name??
Dim pd As New PrintDocument()
AddHandler pd.PrintPage, AddressOf PrintDocument1_PrintPage
pd.PrinterSettings.PrinterName = "//DELLNAS1/Cashiers_Main"
If pd.PrinterSettings.IsValid Then
pd.Print()
Else
MessageBox.Show("Printer is invalid." & vbCrLf & sPrinterName &
vbCrLf & pd.PrinterSettings.ToString)
End If
I always end up with the Else stmt.
If I print, the error message is:
An unhandled exception of
type 'System.Drawing.Printing.InvalidPrinterException' occurred in
system.drawing.dll
Additional information: Tried to access printer '//DELLNAS1/Cashiers_Main'
with invalid settings.
Apparently .PrinterName is not enough to select a printer. Any Ideas??
Thanks
Chuck