为什么DataBinding第二次无效?

Hao*_*Hao 5 c# data-binding datasource bindingsource winforms

我更改BindingSource的数据源时得到的错误

"数据绑定找不到适合所有绑定行的行,适合所有绑定"

        this.RemoveAllBindings(); // My work-around for the meantime

        bdsOrder.DataSource = _ds.Tables["orders"]; // errors here on second time around(first time is blank datatable, second time is when i open existing record, then it errors), dataset comes from Remoting
        bdsOrderDetail.DataSource = _ds.Tables["order_detail"];

        bdsPhoto.DataSource = _ds.Tables["order_photo"];
        bdnPhoto.BindingSource = bdsPhoto;
Run Code Online (Sandbox Code Playgroud)

我的Helper扩展方法解决了困扰"数据绑定无法找到行......"的错误.

namespace MycComponentExtension
{
    public static class Helper
    {
        public static void RemoveAllBindings(this Form form)
        {
            RemoveAllBindings((Control)form);
        }

        private static void RemoveAllBindings(this Control root)
        {
            foreach (Control c in root.Controls)
            {
                if (c.Controls.Count > 0) RemoveAllBindings(c);

                root.DataBindings.Clear();
            }
        }
Run Code Online (Sandbox Code Playgroud)

"DataBinding找不到行......"的含义是什么意思,如果可能的话,我可以消除我的解决方法吗?

Mar*_*man 3

当不涉及 DataGridView 时,我看到了此错误,但我的数据源正在从另一个线程更新(顽皮!)并且我的绑定具有 FormattingEnabled=false。改变这两个似乎可以解决问题。