Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Printer Dialog Question
Message
De
18/09/2001 10:04:26
 
 
À
18/09/2001 09:48:15
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Divers
Thread ID:
00557798
Message ID:
00557814
Vues:
14
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform