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!

commondialog.showprinter - get the printer user choose ?

Status
Not open for further replies.

ooops

MIS
Dec 21, 2000
91
US
Hi all,

This is what I have:

frmMain.CommonDialog1.ShowPrinter
numCopies = frmMain.CommonDialog1.Copies
frmMain.CommonDialog1.PrinterDefault = True

When users start up the application and print for the 1st time, it works fine but later if users want to change to another printer, it doesn't work. It keeps using the printer that was previous chosen. How do i fix the problem ? Thanks so much.

Helen
 

Hi Helen:

Change the sequence of your code lines:
Code:
numCopies = frmMain.CommonDialog1.Copies
frmMain.CommonDialog1.PrinterDefault = True
frmMain.CommonDialog1.ShowPrinter

Are you using Printer (defined as the default system printer) to do the printing?
Code:
Printer.Print "This is a test."
Printer.EndDoc

Cassie
 

Hi Helen:

Another thing to consider is the MSDN description of PrinterDefault lists the following note:

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.

Cassie
 
Hi Cassie,

Thanks so much for your help. I really appreciate it. However it's still not working right. I do have printer.EndDoc but my app keeps using the printer user chooses at the very beginning and refuses to pick up the new choice :( Do you have any other suggestions ?

Helen
 
What does printer.printername reveal after the second try?

Thanks,
James
[shadeshappy] [evil]
"Make it idiot-proof and someone will make a better idiot." ~bumper sticker
 
I posted a reply to a similar question in thread222-553788 but never got a response as to if it fixed the prob or not.


Maybe this will help you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top