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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using getprinter() - if user selects "Cancel" how to know? 3

Status
Not open for further replies.

ahaws

Programmer
Nov 28, 2001
355
US
Hi all -
I use :

set printer to NAME getprinter()
/

So - if user selects "cancel" instead of "Ok"...how to let program know they selected "Cancel"?

When the user hits cancel - just uses last set printer...
would like to stop and not print at that point.

Possible?
Thanks
Angie
 
lcPrinterName = GETPRINTER()
IF EMPTY(lcPrinterName)
* cancelled
ELSE
?lcPrinterName
ENDIF
 
As you have probably noticed CANCEL does not return a value, whereas OK returns the name of the selected printer.

So couldn't you do something along the lines of:

LOCAL lcPrinter, lcComm

lcPriner = GetPrinter()

IF EMPTY(lcPrinter)
MESSAGEBOX("Cancel pressed or no printer installed")
ELSE
lcComm = ;
"SET PRINTER TO '" + ALLTRIM(lcPrinter) + "'"
&lcComm
ENDIF


HTH
Neil

"I like work. It fascinates me. I can sit and look at it for hours..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top