I found the answer:

formatComboBox.DataSource = Enum.GetValues(typeof(FormatType));
formatComboBox.DataBindings.Add("SelectedItem", leagueDataConnector,
"Format");

----- Original Message -----
From: "jhwiedman2004" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 30, 2004 12:22 PM
Subject: [C#.NET] ComboBox DataBinding


>
>
> Hi,
>
> I am using a DataConnector object (new NET 2.0 control) to bind to
> an ArrayList. The ArrayList is a collection of "League" objects.
>
> The League object has a property Format which is of type FormatType,
> an enumeration.
>
> I am trying to bind the displayed items of the ComboBox to the
> enumeration and bind the SelectedValue of the ComboBox to the Format
> property of the current League object. I have had success doing this
> with a DataGridViewComboBoxColumn but can't figure out how to do it
> with the ComboBox.
>
> formatComboBox.DataBindings.Add("SelectedValue",
> leagueDataConnector, "Format");
>
> formatComboBox.DataSource = Enum.GetValues(typeof(FormatType));
>
> formatComboBox.DisplayMember = ???
>
> formatComboBox.ValueMember = ???
>
> I am not sure what the DisplayMember and ValueMember properties
> should be set to. Am I going about this the right way?
>
> Thanks, Jason
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to