473,416 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

enumerating enum options

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!
Nov 23 '05 #1
4 1280
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 23 '05 #2
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.

Nov 23 '05 #3
Yes, that is what I want to do. I will try it out soon and let you know.

thanks!

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:JD**************@TK2MSFTNGXA02.phx.gbl...
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.

Nov 23 '05 #4
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.

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Glenn Venzke | last post by:
I'm writing a class with a method that will accept 1 of 3 items listed in an enum. Is it possible to pass the item name without the enum name in your calling statement? EXAMPLE: public enum...
5
by: Sriram Rajagopalan | last post by:
Hi, Is the extra comma at the end of an enumerator-list valid according to the C standards? With the gcc compiler the following is valid: enum DAYS {MONDAY, TUESDAY, }day1; gcc does not...
21
by: Andreas Huber | last post by:
Hi there Spending half an hour searching through the archive I haven't found a rationale for the following behavior. using System; // note the missing Flags attribute enum Color {
4
by: Brian P. Bailey | last post by:
Hello, I'm trying to enumerate the fixed-pitch font families installed on a system. I am _not_ trying to create a generic monospaced font. I've tried looking at: FontFamily...
2
by: pdavis68 | last post by:
How can I iterate through all the values of an enum? I'm looking through all the information of the type in the watch window to see if there's some way to get at the values through reflection, but...
16
by: Simon | last post by:
Hi all, I think I've seen someone passing an emumeration in code before. Can anyone tell me if thats possible and why i would want to. Many thanks Kindest Regards
4
by: Shayne H | last post by:
What is the best way to enumerate a grouping of strings? The way I have been doing it is: Public Enum PlatformID Unknown Win16 Win32 Win32NT WinCE End Enum
3
by: Joe User | last post by:
Hi - I found the class below on another website (www.devx.com) and can't seem to figure out how to make a call to this class to retrieve the machines and put them in a listbox. I am definitely a...
3
by: Anthony Sox | last post by:
Does anyone know if its possible to use an enum structure as a data source for a combo box or list box. if not, is it possible to enumerate an enum and list it values Thanks in advance
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.