if you want to display only the filtered rows use BindingSource.Filter
property.
Here is a good sample in MSDN
bindingSource.Filter = "columnname = 'value'";
private void button1_Click(object sender, EventArgs e)
{
string searchValue = textBox1.Text;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
bindingSource.Filter = string.Format("{0} = '{1}'","YourColumnName", searchValue );
//here you can do selection if you need
}
To remove filter use the following
bindingSource.RemoveFilter();
or
bindingSource.Filter = null;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…