+6  A: 

Yes.

combobox.DataSource = Enum.GetValues(typeof(SomeEnum));
SLaks
@Adam: Thanks; you beat me by 7 seconds.
SLaks
Oh how nice! Such useful things in .NET!
Serg
8 minute wait time
Serg
A: 

Here's some code we used on a recent project. It handles localized Enum strings (by passing in a ResourceManager object) and populates the .Items array directly instead of using a DataSource -- this is useful for populating a ComboBox, including setting its .SelectedItem, before making it or its parent controls visible.

public static void PopulateComboBox<T>(ComboBox box, ResourceManager res) {
    box.FormattingEnabled = true;
    ListControlConvertEventHandler del = delegate(object sender, ListControlConvertEventArgs e) {
        e.Value = res.GetString(e.Value.ToString());
    };
    box.Format -= del;
    box.Format += del;
    box.BeginUpdate();
    box.Items.Clear();
    foreach(T value in Enum.GetValues(typeof(T))) {
        box.Items.Add(value);
    }
    box.EndUpdate();
}

Use it like:

PopulateComboBox<MyEnum>(myComboBox, MyEnumStrings.ResourceManager);
Daniel Pryden