Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb_dotnet thread: Selecting Printer W/O DialogBox


Message #1 by "Chuck Snyder" <csnyder@p...> on Thu, 19 Sep 2002 22:48:44
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 

  Return to Index