【发布时间】:2018-07-25 16:59:18
【问题描述】:
我正在使用BindingSource 在多个数据库调用中收集一些DataGridViews。
我想要做的是将BindingSource 的.List 属性中的所有DataGridViews 合并为一个,以便我可以使用DataGridView.DataSource = BindingSource。
我尝试了以下方法,但它只绑定集合本身,而不是 .List 属性。
BindingSource _bindingSource = new BindingSource();
...
...
while(<doing database calls>) {
// Populate _DataGridView with some a DB Call
_bindingSource.Add(_DataGridView); // Add _DataGridView to the _bindingSource
}
DataGrid.Datasource = _bindingSource;
我想要的是这样的
// Populate _bindingSource with the .List property/or all the items within _bindingSource
DataGrid.Datasource = _bindingSource[0] + _bindingSource[1] + ..
【问题讨论】:
标签: c# winforms data-binding datagridview odp.net