Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select a printer without changing the default

Status
Not open for further replies.

sjulian

Programmer
Aug 15, 2000
56
US
I am a fairly new programmer in VB. How do I use the common dialog to allow the user to select a printer. Right now the printer is selected, but it become the default. Also, where do I find where all the values are stored from the common dialog? For instance, the name of the printer selected?
Thanks
 
This is the website address to get a program that lets you set a printer's orientation in the program without the user having to change it. Also I believe it doesn't change the default printer's default orientation, so all other documents will still print right.

As for selecting a printer I found this in the MSDN Help on my PC:

PrinterDefault Property


Returns or sets an option that determines if the user's selections in the Print dialog box are used to change the system's default printer settings.

Syntax

object.PrinterDefault [= value]

The PrinterDefault property syntax has these parts:

Part Description
object Anobject expression that evaluates to an object in the Applies To list.
value ABoolean expression specifying whether the user's selections are used to change the system's default printer settings, as described in Settings.


Settings

The settings for value are:

Setting Description
True Any selections the user makes in the Setup portion of the Print dialog box (printer selection, orientation, and so on) are used to change the printer settings in the system's registry.
False User's selections can't be used to change the system's default printer settings.


Remarks

When PrinterDefault is True, you can write code to print directly to the Visual Basic Printer object. Otherwise, you must use the graphic device interface (GDI) calls to print to the printer specified by the control's hDC property.

Note If you've previously printed to the Printer object, make sure you've ended that print job using Printer.EndDoc. This releases the hDC associated with that printer. You will get a new hDC for the default printer the next time you print to the Printer object. If you don't do this, it's possible for the user to select a new printer while the Printer object contains ahandle to the old printer.

Data Type

Boolean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top