Private Sub LoadSortedDepartmentList() Dim strEnumName As String For Each strEnumName In [Enum].GetNames(GetType(Departments)) slDepartments.Add(CType([Enum].Parse(GetType(Departments), strEnumName), Integer), SpaceCamelCase(strEnumName)) Next End SubNow if I ever added another value to the enum, it would be added to the sortedlist automatically. SpaceCamelCase is a method that turns a camelcase word like AllDepartments to All Departments.
sl.IndexOfKey(DataBinder.Eval(Container, "DataItem.iDepartment"))
I ended up doing the following in the HTML of the datagrid, which allows me to not have to use a sorted list at all and still use the enum:SpaceCamelCase([Enum].GetName(GetType(NewsMaintenance.Enums.Departments), (DataBinder.Eval(Container, "DataItem.iDepartment"))))I am not sure if this way is better or worse than what you originally proposed. It is different though so I am not sure if there are potential problems with doing it this way. I would appreciate any comments about doing it this way versus using a sorted list.