displaying enum's to a user  
Author Message
NewbieDude





PostPosted: Windows Forms General, displaying enum's to a user Top

hi there,

//example enum:

public enum Status

{

New=0,

Modified=1,

VeryOld

}

//using enum:

myobject.Status=Status.VeryOld

//example of displaying it to the user:

myobject.Status.ToString();

The user will see the "VeryOld". How can I actually store the spaced value in the enum i.e. "Very Old" or do I have to manually check the enum and then add the space




Windows Forms23  
 
 
PJ. van de Sande





PostPosted: Windows Forms General, displaying enum's to a user Top

This is not possible. You can use a translation class, that translates a enum value to a localized string for het user, like:


public String GetString( Status value )
{
switch( value )
{
case Status.New:
return "New";
}
}