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
Divers
Thread ID:
00922355
Message ID:
00922613
Vues:
27
Hi Allan,

Sorry I kinda jumped the gun there. I assumed PaperSource was an enumeration and just took some code I had that worked on a different enumeration and changed the type names. I wish the UT text editor could check sample code for compile errors.

Anyway, I did some more investigation and found how to do this. It's ugly but this snippet works:
Imports System.Drawing.Printing
...
Dim doc As New PrintDocument
Dim psk As PaperSourceKind

psk = CType([Enum].Parse(GetType(PaperSourceKind), "Upper"), PaperSourceKind)
For Each ps As PaperSource In doc.PrinterSettings.PaperSources
    If ps.Kind = psk Then
        doc.DefaultPageSettings.PaperSource = ps
        Exit For
    End If
Next
I hope this helps.
---
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://www.msmvps.com/windsor
http://www.g6consulting.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform