Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
BindingSource Problem with WinGrid??
posted

Hi,

We have a WinForm which has a WinGrid binding to a BindingSource with DataSource set to a TypeSafe BindingList.

A background process will update this BindingList periodically by calling the BindingList's SetItem or Add method.

However, on occasion, we encountered the following exception:

  <ExceptionType>System.InvalidOperationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
  <Message>BindingSource cannot be its own data source. Do not set the DataSource and DataMember properties to values that refer back to BindingSource.</Message>
  <Source>System.Windows.Forms</Source>
  <HelpLink />
  <Property name="Data">System.Collections.ListDictionaryInternal</Property>
  <Property name="TargetSite">Int32 get_Count()</Property>
  <StackTrace>   at System.Windows.Forms.BindingSource.get_Count()
   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.InnerList_ListChanged(Object sender, ListChangedEventArgs e)
   at System.ComponentModel.BindingList`1.OnListChanged(ListChangedEventArgs e)
   at System.ComponentModel.BindingList`1.SetItem(Int32 index, T item)
...

 Although I don't think WinGrid would be the cause of this exception, I would like to know if there is anything that I might be doing wrong which caused this problem... 

Any help would be appreciated.

Thanks.

Kai