【问题标题】:Get filtered result from BindingSource to table/dataset?将过滤结果从 BindingSource 获取到表/数据集?
【发布时间】:2011-09-29 19:20:00
【问题描述】:

我正在使用连接到DataGridViewBindingSource 来过滤显示的数据。

我想知道将过滤结果获取到 GridView 之外的其他东西的最佳方法是什么?

我问这个是因为我想将过滤后的结果用于一些ComboBoxes。现在我通过 BindingSource 过滤的 DataTable 填充这些。

简而言之,我如何将过滤后的 BindingSource 结果作为DataGridView以外的其他来源?

【问题讨论】:

  • 请将您的示例作为答案,如果它确实可以解决您的问题,请接受它。

标签: c# combobox bindingsource


【解决方案1】:

其实我相信我终于找到了解决办法。

sourceDataTable.DefaultView.RowFilter = bindingSource.Filter;
DataTable destinationDataTable = sourceDataTable.DefaultView.ToTable();

【讨论】:

    猜你喜欢
    • 2013-04-10
    • 1970-01-01
    • 2016-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-22
    相关资源
    最近更新 更多