Filtering DataGridView without changing datasource

前端 未结 7 1927
渐次进展
渐次进展 2020-11-22 06:55

I\'m developing user control in C# Visual Studio 2010 - a kind of \"quick find\" textbox for filtering datagridview. It should work for 3 types of datagridview datasources:

7条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 07:37

    I found a simple way to fix that problem. At binding datagridview you've just done: datagridview.DataSource = dataSetName.Tables["TableName"];

    If you code like:

    datagridview.DataSource = dataSetName;
    datagridview.DataMember = "TableName";
    

    the datagridview will never load data again when filtering.

提交回复
热议问题