Combining flag enumerations

  • Thread starter Thread starter wingers
  • Start date Start date
W

wingers

Guest
Hi all

I have some code as below which sets values in a flag variable depending on values selected on a form with checkboxes

e.g.

' set specific permissions as per check boxes
Dim permissions As PdfPermissionsFlags = 0
If chkAllowPrinting.Checked = True Then
permissions += PdfPermissionsFlags.Print
End If

If chkAllowModification.Checked = True Then
permissions += PdfPermissionsFlags.EditAnnotations
permissions += PdfPermissionsFlags.EditContent
End If

If chkAllowDataExtraction.Checked = True Then
permissions += PdfPermissionsFlags.CopyContent
End If
security.Permissions = permissions


Visual Studio gives me an error / warning of

BC42016 Implicit conversion from 'Integer' to 'PdfPermissionsFlags'.

How can I avoid this warning?

does it matter?

what is a better way of doing it? I need to 'combine' permissions depending on what is selected

for info:-

PdfPermissionsFlags.Print = 4
PdfPermissionsFlags.EditContent = 8
PdfPermissionsFlags.CopyContent = 16
PdfPermissionsFlags.EditAnnotations = 32




Darren Rose

Continue reading...
 
Back
Top