本文介绍了如何在datagridview中显示所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我在datagridview中过滤或搜索特定行,之后我想取消过滤器并按下按钮显示datagrideview中的所有行(全部显示)。
我应该在什么代码中写入
If I filter or search for specific rows in the datagridview, and after that I want to cancel the filter and show all the rows in the datagrideview by button(show all).
what code should I write in The button
推荐答案
private void buttonShowAllRows_Click(object sender, EventArgs e)
{
table1BindingSource.Filter = null;
}
有时阅读可用文档确实很好。 :-)
[]
请参阅默认值和备注部分。
您也可以致电 []方法。
Sometimes it is actually good to read the available documentation. :-)
BindingSource.Filter Property[^]
See the default value and the remarks section.
You can also call the BindingSource.RemoveFilter[^] method.
con.Open();
da = new OleDbDataAdapter(" select * from table name", con);
DataSet ds = new DataSet();
da.Fill(ds, "tablename");
dataGridView1.DataSource = ds.Tables[0];
ds.Tables.Clear();
con.Close();
这篇关于如何在datagridview中显示所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!