locked
BindingList : How to cancel AddNew() RRS feed

  • Question

  • Hello,

    I have implemented a CustomBindingList that derives from BindingList.

    I need to be able to cancel the AddNew call.
    I have overrided the method but I'm not able to cancel it

    Something like this would be perfect !

    protected override object AddNewCore()
    {
           object l_ret = null;
           if (a_test == false)
           {
              this.CancelNew();
           }
            else
           {
               l_ret = base.AddNewCore();
            }
           return l_ret;
    }

    Any idea ?
    Thanks for your help

    Stéphane


       
    Thursday, April 5, 2007 1:23 PM

Answers

All replies

  • Why do you want to be able to cancel an AddNew?
    Thursday, April 5, 2007 1:32 PM
  • because I have two BindingLists, one local and one remote.
    The local list that is binded to a datagridview.
    When the user try to insert a new item in the local List, if I fail to insert the item remotely I want to cancel it in the local list....
    Thursday, April 5, 2007 1:54 PM
  • Make you custom BindingList Implement the ICancelAddNew Interface so it has transaction support
    Thursday, April 5, 2007 7:14 PM
  • but BindingList already implement this interface ?

    Do you suggest implent it again ?

    Friday, April 6, 2007 7:25 PM