I tried that, and it gives me the same error. I don't know if it is the
problem or not, but here is the declaration of the property that the user
uses to enter the enumeration type:
Private _enumerationtype As System.Type
Public Property EnumerationType() As System.Type
Get
Return Me._enumerationtype
End Get
Set(ByVal value As System.Type)
Me._enumerationtype = value
End Set
End Property
Any other ideas? Thanks.
--
Nathan Sokalski
njsokalski at (no spam) hotmail.com
http://www.nathansokalski.com/
"Captain Jack" <CaptainJack1024 at (no spam) comcast.net> wrote in message
news:LJednS_qi_YjSGzXnZ2dnUVZ_gWdnZ2d at (no spam) giganews.com...
"Nathan Sokalski" <njsokalski at (no spam) hotmail.com> wrote in message
news:%23kdK0MYXKHA.3720 at (no spam) TK2MSFTNGP02.phx.gbl...
I have an ASP.NET Control that takes an enumeration type as a property.
If I hardcode the type into my code as follows:
Dim names() As String =
System.Enum.GetNames(GetType(NathanSokalski.Months))
Everythig works fine, but if I use the property, as in the following:
Dim names() As String = System.Enum.GetNames(Me._enumerationtype)
I recieve the following error:
Cannot create an object of type 'System.Type' from its string
representation 'NathanSokalski.Months' for the 'EnumerationType'
property.
How can I allow the user to enter an enumeration type as a property? Any
help (or examples) would be appreciated. Thanks.
--
Nathan Sokalski
njsokalski at (no spam) hotmail.com
http://www.nathansokalski.com/
Adding a call to the GetType() method of the property might do the trick,
as in:
Dim names() As String =
System.Enum.GetNames(Me._enumerationtype.GetType())
--
Jack