Home All Groups Group Topic Archive Search About

BindingSource.EndEdit and Position

Author
3 Nov 2007 8:11 PM
Samuel_García
When I call BindingSource.EndEdit on one of the BindingSources of my
application, it correctly finishes the addition of the new row but
surprisingly it also resets its Position to zero (and so also changes the
object referenced by its Current property to the first item on the DataView
that underlies).

I would like to know if this is an expected behavior. It does not happen
with all my BindingSources.

I've handled the BindingSource.CurrentChanged event and I see something like
this in the call stack:

  MyForm.bindingSource_CurrentChanged
  [Native to managed]
  [Managed to native]
  System.Windows.Forms.dll!System.Windows.Forms.BindingSource.OnCurrentChanged
  System.Windows.Forms.dll!System.Windows.Forms.BindingSource.CurrencyManager_CurrentChanged
  System.Windows.Forms.dll!System.Windows.Forms.CurrencyManager.OnCurrentChanged
  System.Windows.Forms.dll!System.Windows.Forms.CurrencyManager.ChangeRecordState
  System.Windows.Forms.dll!System.Windows.Forms.CurrencyManager.List_ListChanged
  [Native to managed]
  [Managed to native]
  System.Windows.Forms.dll!System.Windows.Forms.BindingSource.OnListChanged
  System.Windows.Forms.dll!System.Windows.Forms.BindingSource.InnerList_ListChanged
  System.Data.dll!System.Data.DataView.OnListChanged
  System.Data.dll!System.Data.DataView.IndexListChanged
  System.Data.dll!System.Data.DataViewListener.IndexListChanged
  System.Data.dll!System.Data.Index.OnListChanged
  System.Data.dll!System.Data.Index.RecordChanged
  System.Data.dll!System.Data.DataTable.RecordChanged
  System.Data.dll!System.Data.DataTable.SilentlySetValue
  System.Data.dll!System.Data.DataTable.EvaluateDependentExpressions
  System.Data.dll!System.Data.DataTable.EvaluateExpressions
  System.Data.dll!System.Data.DataTable.SetNewRecordWorker
  System.Data.dll!System.Data.DataTable.InsertRow
  System.Data.dll!System.Data.DataView.FinishAddNew
  System.Data.dll!System.Data.DataRowView.EndEdit
  System.Windows.Forms.dll!System.Windows.Forms.CurrencyManager.EndCurrentEdit
  System.Windows.Forms.dll!System.Windows.Forms.BindingSource.EndEdit

Thank you very much in advance

AddThis Social Bookmark Button