Updating of BindingSource in WinForms does not update Datasource Collection

前端 未结 4 793
广开言路
广开言路 2021-02-14 00:57

I want to display a custom collection in a DataGridView in a Windows Forms app. This custom collection implements ICollection, and IEnumerable

4条回答
  •  臣服心动
    2021-02-14 01:06

    The problem is Fill Adaptor. When you load your form, the Fill is done for you. Just make sure to do a Refill and then follow up with Reset bindings post any data changes and Grid will get refreshed.

    Example :

    WorkTableAdapter.Insert(objData.XAttribute, "",
      objData.YAttribute,objLoanData.Amount_IsValid, DateTime.Now, DateTime.Now);
    this.WorkTableAdapter.Fill(this.POCDataSet.Work);
    this.WorkBindingSource.ResetBindings(false);
    

提交回复
热议问题