all groups > dotnet windows forms databinding > september 2006 >
You're in the

dotnet windows forms databinding

group:

Databinding an array of enum types to a DataGridViewComboBoxColumn


Databinding an array of enum types to a DataGridViewComboBoxColumn Haxan
9/29/2006 5:30:01 PM
dotnet windows forms databinding:
Hi,

I have a DataGridView which contains a column of type
DataGridViewComboBoxColumn. Im trying to bind the DataGridViewComboBoxColumn
to an array of enums.

The following is how my enums look

enum myEnum
{
enumA,
enumB,
enumC,
enumD
}

My array contains elements of type myEnum

My DataGridViewComboBox contain the following elements
enumA, enumB, enumC, enumD

Since this seems to be complex binding I was told that I need to use IList.
Also what should I set for DisplayMember and ValueMember properties.

Will appreciate help on the above.
Re: Databinding an array of enum types to a DataGridViewComboBoxColumn Nathan Baulch
10/17/2006 1:03:00 AM
[quoted text, click to view]

I may be missing a subtlety in your scenario, but it should be as easy =
as:

column1.DataSource =3D Enum.GetValues(typeof(myEnum));


AddThis Social Bookmark Button