Reputation: 3515
I have enum datatype
public enum UserChoices { Basic = 0, Lite = 1, Standard = 2 };
How can I use this enum property inside winforms radio button choices?
Upvotes: 1
Views: 457
Reputation: 2587
Use below code to get the name and values in an Array.
string[] names = Enum.GetNames(typeof(MyEnum));
MyEnum[] values = (MyEnum[])Enum.GetValues(typeof(MyEnum));
Now
for( int i = 0; i < names.Length; i++ )
{
//Add this item to radio button list
//names[i] will be going to text
//values[i] will be going to value
}
Queries welcomed!
Upvotes: 3