Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2006

Tip: Looking for answers? Try searching our database.

enum values?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
HockeyFan - 13 Oct 2006 12:56 GMT
I'm looping through a class to get the properties and the values
returned are of enum types.  Is there a way to programmatically find
out what the possible values are?
Any help on this is greatly appreciated.  thanx.
Sergej Sharkov - 13 Oct 2006 13:48 GMT
HockeyFan schrieb:
> I'm looping through a class to get the properties and the values
> returned are of enum types.  Is there a way to programmatically find
> out what the possible values are?
> Any help on this is greatly appreciated.  thanx.

Enum.GetNames()
Sergej Sharkov - 13 Oct 2006 13:48 GMT
HockeyFan schrieb:
> I'm looping through a class to get the properties and the values
> returned are of enum types.  Is there a way to programmatically find
> out what the possible values are?
> Any help on this is greatly appreciated.  thanx.

Enum.GetNames()
HockeyFan - 13 Oct 2006 14:45 GMT
Thanx for the quick response.  I have another question:

The object I'm working with has a few properties that are like:

           Public Enum Q010resp As Integer
               Alone = 11
               wSpouse = 12
               wChildren = 13
               wRelatives = 14
               wFriends = 15
               wSpouseAndChildren = 16
               wRelativesAndChildren = 17
               wFriendsAndChildren = 18
               Other = 19
               NotAnswered = 0
           End Enum

I am trying to find out what type this member is by this:

                   Dim sType As Type = clsProperty.GetType()

It basically tells me that it's a RunTime type.  How do I get the
possible values of 11, 12, 13, etc for this item?

> HockeyFan schrieb:
> > I'm looping through a class to get the properties and the values
[quoted text clipped - 3 lines]
> >
> Enum.GetNames()
Lee - 13 Oct 2006 14:52 GMT
Enum.GetNames() will get the names in the Enum (e.g. Alone, wSpouse)
and Enum.GetValues() will get the value associated with each name (e.g.
11, 12).

The elements in each of the 2 returned arrays are in the same sequence.

--
// Lee Silver
// Information Concepts Inc.

> Thanx for the quick response.  I have another question:
>
[quoted text clipped - 27 lines]
> > >
> > Enum.GetNames()
HockeyFan - 13 Oct 2006 15:33 GMT
Okay.  This is useful information.
I go through the MemberInfo for my enums
but when I do a mem.MemberType I get NestedType as the type.

> Enum.GetNames() will get the names in the Enum (e.g. Alone, wSpouse)
> and Enum.GetValues() will get the value associated with each name (e.g.
[quoted text clipped - 37 lines]
> > > >
> > > Enum.GetNames()

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.