# Friday, April 23, 2004

Ever wondered how to enumerate an enum? Well I did yesterday when I needed it to list the installed fonts on a system. It's actually very simple once you know how to :)

For Each s As String In [Enum].GetNames(GetType(System.Drawing.KnownColor))

colorDropDownList.Items.Add(New ListItem(s, s))

Next s

UPDATE: Found an article on Codeproject.com which describes even more tricks with enum. Go have a read.

Comments are closed.