Hi,

I have a problem in filtering the data table for the second time.

What I have done is till now is to filter the data table sucessfully for the first time but was unable to filter the resultant data table again since the information after the first filter is also in the picture.

Can some help me solving this?

My code is

private void valueIsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
           DataTable t = new DataTable();
           
           t = (DataTable)this.dataGridView1.DataSource;
        
            data =textBox1.Text;
          

            DataTable t = new DataTable();


            if (header == "Key")
            {
                t.DefaultView.RowFilter = "Key = " + data + "";
            }
            
                this.dataGridView1.DataSource = t;
            
           
        }

IMHO you should use new data table and fill it from the old one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.