D
dwok
Hello,
I have a class that contains an enumeration and I would like to bind
the members of the enumerations to a drop down list box. If have seen
some examples that use Enum.GetNames and Enum.GetValues but when ever I
pass the name of my enumeration I get an error. Let me illustrate.
--- VB.NET Code ----------
Public Class Phone
Public Enum PhoneNumberType
Home = 1
Work = 2
Mobile = 3
Fax = 4
Pager = 5
End Enum
End Class
--- ASP.NET Code -------
dropDownListBox.DataSource =
System.Enum.GetValues(Phone.PhoneNumberType)
It's here that I get an error. "PhoneNumberType is a type in Phone and
cannot be used as an expression". Any guess on what I might be doing
wrong? Thanks.
-dwok
I have a class that contains an enumeration and I would like to bind
the members of the enumerations to a drop down list box. If have seen
some examples that use Enum.GetNames and Enum.GetValues but when ever I
pass the name of my enumeration I get an error. Let me illustrate.
--- VB.NET Code ----------
Public Class Phone
Public Enum PhoneNumberType
Home = 1
Work = 2
Mobile = 3
Fax = 4
Pager = 5
End Enum
End Class
--- ASP.NET Code -------
dropDownListBox.DataSource =
System.Enum.GetValues(Phone.PhoneNumberType)
It's here that I get an error. "PhoneNumberType is a type in Phone and
cannot be used as an expression". Any guess on what I might be doing
wrong? Thanks.
-dwok