472,952 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Enum GetValues/GetNames .. is this odd?

It's a time saver to "bind" .Net enums to list and comboboxes and all the
samples out there seem to use GetNames and GetValues pretty interchangeably.

So I was wondering what the logic is to the System.Drawing.RotateFlipType
enumeration.

GetNames and GetValues results don't seem to synch up and binding to
GetValues seems to create duplicates of some elements while"losing" others,
and I haven't seen any mention of why that might be.

To see it just drop a couple of tall listboxes on a form and in the load
add:

ListBox1.DataSource = System.Enum.GetNames(GetType(RotateFlipType))
ListBox2.DataSource = System.Enum.GetValues(GetType(RotateFlipType))

Or dump the same to Output:

Dim arValues as String() = System.Enum.GetValues(GetType(RotateFlipType))
Dim arValues As RotateFlipType() =
System.Enum.GetValues(GetType(RotateFlipType))

For i As Integer = 0 To arNames.Length - 1
Debug.WriteLine(arNames(i) & vbTab & arValues(i).ToString)
Next

yields:

Rotate180FlipXY RotateNoneFlipNone
RotateNoneFlipNone RotateNoneFlipNone
Rotate90FlipNone Rotate270FlipXY
Rotate270FlipXY Rotate270FlipXY
Rotate180FlipNone RotateNoneFlipXY
RotateNoneFlipXY RotateNoneFlipXY
Rotate270FlipNone Rotate90FlipXY
Rotate90FlipXY Rotate90FlipXY
RotateNoneFlipX Rotate180FlipY
Rotate180FlipY Rotate180FlipY
Rotate90FlipX Rotate270FlipY
Rotate270FlipY Rotate270FlipY
Rotate180FlipX RotateNoneFlipY
RotateNoneFlipY RotateNoneFlipY
Rotate270FlipX Rotate270FlipX
Rotate90FlipY Rotate270FlipX

it's not that there's no one to one relation, but that GetValues returns the
odd duplcate text values. Is it just something about this particular enum
or is this logical and do others that I've not seen yet also do this?

Just wonderin'

smith
kirkland, wa
www.smithvoice.com
Jul 21 '05 #1
2 2791
Ahem, bad paste. Those arrays are of course:

Dim arNames As String() = _
System.Enum.GetNames(GetType(RotateFlipType))

Dim arValues As RotateFlipType() = _
System.Enum.GetValues(GetType(RotateFlipType))

....
For i As Integer = 0 To arNames.Length - 1
Debug.WriteLine(arNames(i) & vbTab & arValues(i).ToString)
Next

yields:

Rotate180FlipXY RotateNoneFlipNone
RotateNoneFlipNone RotateNoneFlipNone
Rotate90FlipNone Rotate270FlipXY
Rotate270FlipXY Rotate270FlipXY
Rotate180FlipNone RotateNoneFlipXY
RotateNoneFlipXY RotateNoneFlipXY
Rotate270FlipNone Rotate90FlipXY
Rotate90FlipXY Rotate90FlipXY
RotateNoneFlipX Rotate180FlipY
Rotate180FlipY Rotate180FlipY
Rotate90FlipX Rotate270FlipY
Rotate270FlipY Rotate270FlipY
Rotate180FlipX RotateNoneFlipY
RotateNoneFlipY RotateNoneFlipY
Rotate270FlipX Rotate270FlipX
Rotate90FlipY Rotate270FlipX

it's not that there's no one to one relation, but that GetValues returns
the odd duplcate text values. Is it just something about this particular
enum or is this logical and do others that I've not seen yet also do this?

Just wonderin'

smith
kirkland, wa
www.smithvoice.com

Jul 21 '05 #2
Oy. I just didn't wrap my head fully around the degrees and flippage:
http://thedotnet.com/howto/work148254.aspx

Why do we always figure things out just two tries after we've publicly said
that we couldn't do it? And why is it a sliding scale so that you have to
admit it first and only then do the extra tries work?

The rules of this universe were created by a trickster.

smith

"smith" <rc********@smithvoiceTAKEOUT.com> wrote in message
news:y1*****************@newsread1.news.pas.earthl ink.net...
Ahem, bad paste. Those arrays are of course:

Dim arNames As String() = _
System.Enum.GetNames(GetType(RotateFlipType))

Dim arValues As RotateFlipType() = _
System.Enum.GetValues(GetType(RotateFlipType))

...
For i As Integer = 0 To arNames.Length - 1
Debug.WriteLine(arNames(i) & vbTab & arValues(i).ToString)
Next

yields:

Rotate180FlipXY RotateNoneFlipNone
RotateNoneFlipNone RotateNoneFlipNone
Rotate90FlipNone Rotate270FlipXY
Rotate270FlipXY Rotate270FlipXY
Rotate180FlipNone RotateNoneFlipXY
RotateNoneFlipXY RotateNoneFlipXY
Rotate270FlipNone Rotate90FlipXY
Rotate90FlipXY Rotate90FlipXY
RotateNoneFlipX Rotate180FlipY
Rotate180FlipY Rotate180FlipY
Rotate90FlipX Rotate270FlipY
Rotate270FlipY Rotate270FlipY
Rotate180FlipX RotateNoneFlipY
RotateNoneFlipY RotateNoneFlipY
Rotate270FlipX Rotate270FlipX
Rotate90FlipY Rotate270FlipX

it's not that there's no one to one relation, but that GetValues returns
the odd duplcate text values. Is it just something about this particular
enum or is this logical and do others that I've not seen yet also do
this?

Just wonderin'

smith
kirkland, wa
www.smithvoice.com


Jul 21 '05 #3

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

Similar topics

1
by: Daylor | last post by:
Public Enum COLORS RED= 0 GREEN=1 BLUD =2 ORANGE =4
9
by: thechaosengine | last post by:
Hi all, I have a problem that I havent really come accross before. I need to be able to allow the user to set a dropdown control to a particular colour value. The permissable values come from...
3
by: Richard | last post by:
Okay gang, This should be simple but apparently it's not... I want to use the System.DayOfWeek enum to create and access an array of objects with one object for each day of the week. I'd like...
2
by: Armin Bajramovic | last post by:
Hi, I have enum: public enum StatusEnum { Active = 'A', Nonactive = 'N', Deleted = 'D' }
3
by: cyshao | last post by:
Hi ,my friends: I have a enum type ,EMyEnum , defigned as . I just want to do something like this: foreach( EMyEnum crrEnum in EMyEnum ) { //do something }
2
by: smith | last post by:
It's a time saver to "bind" .Net enums to list and comboboxes and all the samples out there seem to use GetNames and GetValues pretty interchangeably. So I was wondering what the logic is to the...
7
by: Harris | last post by:
Dear all, I have the following codes: ====== public enum Enum_Value { Value0 = 0, Value1 = 10,
34
by: Steven Nagy | last post by:
So I was needing some extra power from my enums and implemented the typesafe enum pattern. And it got me to thinking... why should I EVER use standard enums? There's now a nice little code...
3
by: shapper | last post by:
Hello, I have an enum: Public Enum Color Red Blue Green End Enum
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...

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.