Combobox and Nullable Enum

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian

    Combobox and Nullable Enum

    Is there a way to bind a nullable Enum property to a combo box?

    When choosing a value, and then leaving the combo box, the value reverts
    back to the original value. It seems the databinding doesn' accept the
    new value.


    To populate the combo box:

    cboPageMode.Dat aSource = Enum.GetValues( typeof(PageMode ));


    And for the data binding:

    cboPageMode.Dat aBindings.Add(" SelectedItem", _itemsDBS, "Mode");
  • Brian

    #2
    Re: Combobox and Nullable Enum

    Brian wrote:[color=blue]
    > Is there a way to bind a nullable Enum property to a combo box?
    >
    > When choosing a value, and then leaving the combo box, the value reverts
    > back to the original value. It seems the databinding doesn' accept the
    > new value.
    >
    >
    > To populate the combo box:
    >
    > cboPageMode.Dat aSource = Enum.GetValues( typeof(PageMode ));
    >
    >
    > And for the data binding:
    >
    > cboPageMode.Dat aBindings.Add(" SelectedItem", _itemsDBS, "Mode");[/color]


    I changed it to this, and it seems to work now:

    cboPageMode.Dat aBindings.Add(" SelectedItem", _itemsDBS,
    "Mode", true,
    System.Windows. Forms.DataSourc eUpdateMode.OnV alidation,
    null);

    Comment

    Working...