Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printer Dialog Question
Message
From
18/09/2001 10:04:26
 
 
To
18/09/2001 09:48:15
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00557798
Message ID:
00557814
Views:
16
This message has been marked as the solution to the initial question of the thread.
>Hi to all,
>
>Is there a way I can determine the selected button in the Printer Dialog box either the OK or Cancel button is choosen?
>
>I used the following code the open the Printer Dialog box:
>
>CommonDialog1.ShowPrinter
>
>Hope to find and answer here.
>Thanks in advance.
>
>Noel

You can set CancelError to True so it generates an error if the user selects the cancel button in the dialog: (this sample from the docs)
Private Sub Command1_Click ()
   Dim BeginPage, EndPage, NumCopies, Orientation, i
   ' Set Cancel to True.
   CommonDialog1.CancelError = True
   On Error GoTo ErrHandler
   ' Display the Print dialog box.
   CommonDialog1.ShowPrinter
   ' Get user-selected values from the dialog box.
   BeginPage   = CommonDialog1.FromPage
   EndPage       = CommonDialog1.ToPage 
   NumCopies   = CommonDialog1.Copies
   Orientation = CommonDialog1.Orientation
   For i = 1 to NumCopies   
   ' Put code here to send data to your printer.
   Next
   Exit Sub
ErrHandler:
   ' User pressed Cancel button.
   Exit Sub
End Sub
HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform