Home All Groups Group Topic Archive Search About
Author
13 Oct 2006 11:56 AM
HockeyFan
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.

Author
13 Oct 2006 12:48 PM
Sergej Sharkov
HockeyFan schrieb:
Show quote
> 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()
Author
13 Oct 2006 12:48 PM
Sergej Sharkov
HockeyFan schrieb:
Show quote
> 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()
Author
13 Oct 2006 1:45 PM
HockeyFan
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?

Sergej Sharkov wrote:
Show quote
> 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()
Author
13 Oct 2006 1:52 PM
Lee
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.


HockeyFan wrote:
Show quote
> 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?
>
> Sergej Sharkov wrote:
> > 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()
Author
13 Oct 2006 2:33 PM
HockeyFan
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.

Lee wrote:
Show quote
> 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.
>
>
> HockeyFan wrote:
> > 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?
> >
> > Sergej Sharkov wrote:
> > > 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()

AddThis Social Bookmark Button