"Steve Teeples" <SteveT@newsgroups.nospamwrote in message
news:A3D9A748-25BC-4AA1-9671-DBF370F4A689@microsoft.com...
Quote:
Given this definition of an enum:
>
enum MyEnum {
[Description("This is a descripiton of D1")]
d1=1,
[Description("This is a description of D2")]
d2=2
}
>
Is there a way to dynamically create this same enum at runtime? I want to
read variable data from a file, but this data into an enum to allow the
user
to make a choice from a CheckedListBox. I am able to do this from a
predefined enum definition but want to be able to do it with variable data
read from files. As the mouse moves over the enumeration the
"Description"
is shown to the user.
>
Is there some example somewhere of how this can be done?
>
--
-----------
Thanks,
Steve
|
I think what you are looking for in this context is not an enum
(programmatic name) but instead a list of dynamic values read from a
database (text file, spreadsheet, dbms, etc.). What you could do to get
this to work would be to load your data into a DataTable and then bind this
DataTable to the CheckedListBox. I'm not sure without testing, but I
believe this to be an easier route than dynamically creating an enum.
HTH,
Mythran