I saw through Stackoverflow that there is an easy way to populate combobox with Enumeration:
cbTipos.DataSource = Enum.GetValues(typeof(TiposTrabajo));
In my case, I defined some description for my enumerations:
public enum TiposTrabajo { [Description("Programacion Otros")] ProgramacionOtros = 1, Especificaciones = 2, [Description("Pruebas Taller")] PruebasTaller = 3, [Description("Puesta En Marcha")] PuestaEnMarcha = 4, [Description("Programación Control")] ProgramacionControl = 5}
This works very well, but it shows the value, not the description. My problem is that I want to show the description of the enumeration in combobox when it has a description or value in case it does not matter. If necessary, I can add a description for values that do not have a description. thanks in advance.
enums c # combobox
Dinalan
source share