DataGridView Cancel Edit Problem

DataGridView Cancel Edit Problem

Old forum URL: forums.lhotka.net/forums/t/2310.aspx


JZuerlein posted on Friday, February 09, 2007

I'm having a problem with a bound DataGridView.

Here are the steps....

The user adds a row to in the DataGridView with its built in functionality, and completes the data entry.

Add a second row in the DataGridView.  The preset values that are assigned in the constructor are displayed, but no data entry is performed.

When you click on the first row the data from the second row disappears. If you attempt to add another row you get an error.

Here is the error I get...

System.InvalidOperationException was unhandled
  Message="Operation is not valid due to the current state of the object."
  Source="System.Windows.Forms"
  StackTrace:
       at System.Windows.Forms.DataGridView.DataGridViewDataConnection.ProcessListChanged(ListChangedEventArgs e)
      

I checked the collection, and all the items have unique ids.  I overrode the RemoveItem sub to see if it gets called, but it does not.  It seems like the ICancelAddNew interface is not working. 

Does anyone have any ideas about how to trouble shoot this?

 

Copyright (c) Marimer LLC