BindingSource bs = new BindingSource(); bs.DataSource = dgvSPage.DataSource; private void textBox1_TextChanged(object sender, EventArgs e) { try { if(dgvSPage.Rows.Count>0) { bs.Filter = string.Format("Id = {0} ", txtsearchId.Text); dgvSPage.DataSource = bs; } if (txtsearchId.Text == string.Empty) { bs.RemoveFilter(); bs.Filter = null; dgvSPage.DataSource = bs; } } catch (Exception er) { MessageBox.Show(er.Message + "\n" + er.Source + "\n" + er.StackTrace + "\n" + er.TargetSite); throw; } }
bs.Filter=String.Format("Id LIKE '%{0}%'", txtsearchId.Text):
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)