Being mostly a back-end programmer, every time I find myself working on a Windows Form I have to remind myself of all these tiny tricks. This time I'll post it on my own blog, so it will be easier for me to look it up in the future.
Say you have an enumerator (MyEnum) and you want to bind its values to a combobox (myCombo) - the simplest way is as so:
myCombo.DataSource = Enum.GetValues(typeof(MyEnum));
No comments:
Post a Comment