setting enumerated types by integer values?

Posted on 2001-08-21
Medium Priority
Last Modified: 2010-04-06
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);


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.
Question by:Pandora
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 27

Accepted Solution

kretzschmar earned 200 total points
ID: 6409819
? maybe

enum := TEnumeratedType(0);
LVL 17

Expert Comment

ID: 6409973
Yes, exactly. Hi meikl, you are fast :-)

Regards, Geo

Author Comment

ID: 6410007
aha! yes brill, thank you once again Meikl!! P.
LVL 27

Expert Comment

ID: 6410011
hi geo,

i'm not really fast, i'm sometimes a bit lucky :-))
LVL 27

Expert Comment

ID: 6410033

thanks pandora,
glad to helped you :-))

meikl ;-)

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month9 days, 8 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question