How to cast an 'enum value_' in OpenEdge

Posted by Peter van Dam on 16-May-2013 05:29

I have come accross a construct in Crystal Reports for .NET that I don't know how to translate from C# to .NET.

This is the C# statement:

reportDocument.PrintOptions.PaperSource = (CrystalDecisions.Shared.PaperSource)paperSourceRaw;

paperSourceRaw is an integer.

The funny thing is that CrystalDecisions.Shared.PaperSource has a number of data members that do not match paperSourceRaw yet it works.

I think this has to do with a special data member called "value_".

The statement works fine in C# and I must make it work in OpenEdge.

Can anyone shed some light on this?

Thanks,

-peter

All Replies

Posted by Admin on 16-May-2013 05:36

Try something similar to this here:

RETURN CAST (System.Enum:ToObject (Progress.Util.TypeHelper:GetType ("System.Windows.Forms.Shortcut":U),

iEnum),

System.Windows.Forms.Shortcut) .

Where iEnum is your integer value and System.Widnows.Forms.Shortcut will be replaced with your enum type.

Good luck.

Posted by Peter van Dam on 16-May-2013 07:44

Brilliant! This works!

(Or at least I don't get a compile or runtime error. Functionally it still does not work )

This thread is closed