enumerating enum options

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all, I currently have a custom vb object which has several Enum
properties. Now, on the end-user web form I am manually displaying a
drop-down list with the options for each of these properties. It would be
nice if I could somehow "read" the various enum options and generate the
drop-down list on the fly. This way, all I have to do is change the vb
object file everytime I want to change any of the enum options and eliminate
having to change the web form too. Any ideas how I can do this?

TIA!
 
Any ideas how I can do this?

The System.Enum type and its GetNames method is a good start.

Just keep in mind that names that make sense to a programmer don't
always make sense to an end user. You can't include spaces and it's
not a very localization friendly way of doing things.


Mattias
 
Hi,

Currently, I am not sure I understand your request very well. Does mattias'
suggesiton of using Enum.GetNames method meet your need? This method will
retrieve all the constant filed names of your enum type, then you can
enumerate through this string collection and populate the dropdown list
yourself.

If we misunderstand you, please feel free to tell us, and a more detailed
and concrete description will be helpful. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Ok, if you need any further help, please feel free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top