Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Casting a string to a PaperSource ...
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Casting a string to a PaperSource ...
Divers
Thread ID:
00922355
Message ID:
00922355
Vues:
57
Hi,

I have a program that performs mail merges (using TX Text Control) - which then prints letters and envelopes.

I'd like to be able to send the envelopes to the "Upper" or "Manual" tray of the printer.

There is a combobox on the form that is populated with the PaperSources available for the default printer (i.e. "Upper", "Lower", "Manual", etc.)

I want to be able to have the item print to the appropriate paper source based on the selection made by the user:
Dim myPrintDocument As New System.Drawing.Printing.PrintDocument

myPrintDocument.PrinterSettings.FromPage = 1
myPrintDocument.PrinterSettings.ToPage = 1

'print in Portrait mode
myPrintDocument.PrinterSettings.DefaultPageSettings.Landscape = False

'set the paper source
myPrintDocument.DefaultPageSettings.PaperSource = CType(Me.cboPaperTrayLetter.Text.Trim, PaperSource)

'print the envelope
Me.txtTemplate.Print(myPrintDocument)
... The problem is that the code:
CType(Me.cboPaperTrayLetter.Text.Trim, PaperSource)
... doesn't work - I get a message saying that "Value of type 'String' cannot be converted to System.Drawing.Printing.PaperSource"

Can anyone point me in the right direction for setting the PaperSource programatically?

Thanks in advance.
Al Williams

Anola MB, CANADA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform