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:
00923147
Vues:
27
Hi Rob,

That's exactly what I was looking for. Thanks for your assistance.

Al

>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.
Al Williams

Anola MB, CANADA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform