Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 143
  • Last Modified:

setting enumerated types by integer values?

Hiya, just a little one.  Is there anyway to set an enumerated type just by setting its ordinal value?  E.g. for:

type TEnumeratedType = (etype1,etype2,etype3);

where:

var
Enum :TEnumeratedType;

I want to set Enum:=etype1 but only by using its ordinal value of 0. ie I want to be able to effectively set Ord(Enum)=0, if you see what I mean!  Is there anyway to do this (*without* writing a conversion function that converts any given integer to the appropriate TEnumeratedType constant)?  Many thanks, P.
0
Pandora
Asked:
Pandora
  • 3
1 Solution
 
kretzschmarCommented:
? maybe

enum := TEnumeratedType(0);
0
 
geobulCommented:
Yes, exactly. Hi meikl, you are fast :-)

Regards, Geo
0
 
PandoraAuthor Commented:
aha! yes brill, thank you once again Meikl!! P.
0
 
kretzschmarCommented:
hi geo,

i'm not really fast, i'm sometimes a bit lucky :-))
0
 
kretzschmarCommented:
oops,

thanks pandora,
glad to helped you :-))

meikl ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now