Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Casting a string to a PaperSource ...
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00922355
Message ID:
00923147
Views:
29
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
Previous
Reply
Map
View

Click here to load this message in the networking platform