Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

DataGridView InvalidOperationException when changing BindingSource.DataSource

$
0
0

I receive an "Operation did not succeed because the program cannot commit or quit a cell value change" error when I change the DataSource of the BindingSource bound to the DataGridView.  This occurs even if I clear the BindingSource (no errors and there are no rows in the DataGridView) and then assign the new DataSource.

                mUtilizations= New Utilizations()
                CU_BindingSource.DataSource = mUtilizations

The cell value must be getting assigned but not committed and then reassigned, but I cannot figure out where. The data displays correctly, although if there were more rows with the initial data the extra rows remain as blank row.

Here is the trace:

  Message=Operation did not succeed because the program cannot commit or quit a cell value change.
  Source=System.Windows.Forms
  StackTrace:
       at System.Windows.Forms.DataGridView.set_CurrentCell(DataGridViewCell value)
       at System.Windows.Forms.DataGridView.OnClearingRows()
       at System.Windows.Forms.DataGridViewRowCollection.ClearInternal(Boolean recreateNewRow)
       at System.Windows.Forms.DataGridView.RefreshColumnsAndRows()
       at System.Windows.Forms.DataGridView.DataGridViewDataConnection.ProcessListChanged(ListChangedEventArgs e)
       at System.Windows.Forms.DataGridView.DataGridViewDataConnection.currencyManager_ListChanged(Object sender, ListChangedEventArgs e)
       at System.Windows.Forms.CurrencyManager.OnListChanged(ListChangedEventArgs e)
       at System.Windows.Forms.CurrencyManager.List_ListChanged(Object sender, ListChangedEventArgs e)
       at System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e)
       at System.Windows.Forms.BindingSource.OnListChanged(ListChangedEventArgs e)
       at System.Windows.Forms.BindingSource.ResetBindings(Boolean metadataChanged)
       at System.Windows.Forms.BindingSource.SetList(IList list, Boolean metaDataChanged, Boolean applySortAndFilter)
       at System.Windows.Forms.BindingSource.ResetList()
       at System.Windows.Forms.BindingSource.ParentCurrencyManager_MetaDataChanged(Object sender, EventArgs e)
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Windows.Forms.CurrencyManager.OnMetaDataChanged(EventArgs e)
       at System.Windows.Forms.CurrencyManager.List_ListChanged(Object sender, ListChangedEventArgs e)
       at System.Windows.Forms.BindingSource.OnListChanged(ListChangedEventArgs e)
       at System.Windows.Forms.BindingSource.ResetBindings(Boolean metadataChanged)
       at System.Windows.Forms.BindingSource.SetList(IList list, Boolean metaDataChanged, Boolean applySortAndFilter)
       at System.Windows.Forms.BindingSource.ResetList()
       at System.Windows.Forms.BindingSource.set_DataSource(Object value)
       at EntryForm.frmEntryForm.LoadUtilizations() in C:\VS 2010 Projects\MOOS.Net\EntryForm\frmEntryForm.vb:line 545
       at EntryForm.frmEntryForm.ComboBindingSource_CurrentItemChanged(Object sender, EventArgs e) in C:\VS 2010 Projects\MOOS.Net\EntryForm\frmEntryForm.vb:line 297
       at System.Windows.Forms.BindingSource.OnCurrentItemChanged(EventArgs e)
       at System.Windows.Forms.BindingSource.CurrencyManager_CurrentItemChanged(Object sender, EventArgs e)
       at System.Windows.Forms.CurrencyManager.OnCurrentChanged(EventArgs e)
  InnerException: 



Viewing all articles
Browse latest Browse all 2535

Trending Articles