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:
00922613
Views:
28
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform