473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Any way to iterate through an Enum?

Hello,

Is there any way to loop through an enumerator? I've searched google, but
just about every link I find shows the VB.net solution, even when I use
"MS+Access" in the search string.

Thanks!
Rick
Sep 16 '06 #1
2 9761
On Sat, 16 Sep 2006 15:29:42 GMT, "Rico" <yo*@me.comwrote:

Not really, unless you use a convention. Off the top of my head:

Enum MyEnum
FirstItem = 0 'By convention ALWAYS start at 0
NextItem = 1
NextNextItem = 2
EnumCount = 3 'Not a real item; just to hold the count
end enum

For i = 0 to MyEnum.EnumCount
'do something
Next i

-Tom.

>Hello,

Is there any way to loop through an enumerator? I've searched google, but
just about every link I find shows the VB.net solution, even when I use
"MS+Access" in the search string.

Thanks!
Rick
Sep 17 '06 #2
No you can't

Enumerated constants could have any value and there isn't a sequence as such
to them nor even any way to find out how many constants there are in the
enumeration.

What are you trying to do really? Instead of asking us how to do what you
think you want to do, if you explain the problem, we might be able to offer
a solution.

--

Terry Kreft
"Rico" <yo*@me.comwrote in message news:GLUOg.5645$KA6.4392@clgrps12...
Hello,

Is there any way to loop through an enumerator? I've searched google, but
just about every link I find shows the VB.net solution, even when I use
"MS+Access" in the search string.

Thanks!
Rick


Sep 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mattias Brändström | last post by:
Hi! Suppose I want to do some thing like this: enum X { A, B, C, D }; int main() { X a1 = { A, B, C, D }; int size_a = sizeof(a1) / sizeof(X);
8
by: Imran | last post by:
Hello All I have a enum decla like this enum Days // Declare enum type Days { saturday, // saturday = 0 by default sunday = 0, // sunday = 0 as well monday, ...
6
by: randy1200 | last post by:
The following enum is given to me, and I can't change it: enum yo { ONE, TWO, THREE }; I have the following: char test = "ONE"; Any ideas on how to see if the string in "test" is in the...
3
by: Billy Porter | last post by:
Greetings, If I populate an ArrayList with values from, let's say, the Keys enum: ArrayList a = new ArrayList(); a.Add(Keys.Home); a.Add(Keys.End); ....then how do I iterate through the...
2
by: Mark | last post by:
Assume you've declared an enum .... public enum MyEnum { First, Second, Third } Without knowing the values of the enum, is it possible to iterate through all the possible values...
2
by: John A Grandy | last post by:
how to iterate through the members of an Enum ? Enum EnumAction None = 0 Action1 = 1 Action2 = 2 Action3 = 3 Action4 = 4 End Enum
6
by: Steven Woody | last post by:
is there any way in C leting me iterate all integer constants in a enum type ? their values might not be continue. thanks. - woody
9
by: Fred Zwarts | last post by:
What is the recommended way to loop over all enum values of a certain enum type? Consider the following definition: typdef enum {A=2, B, C=5, D} E; then for (E x = A; x <= D; ++x) { ... }
1
by: PSN | last post by:
can any one tell me if there is a way to redeclare a typedef enum to add new elements at the end .. Ex: "test.h" typedef enum test1 { hcone = 0, hctwo hcthree, hcfour,
3
by: Desmond Cassidy | last post by:
I created an Enum with the EnumBuilder which allows you to add items with spaces embedded as well as the name of the Enum. e.g. US States and a member of New York The normal way you would iterate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.