HI Guys

Below coding give me an exception
cannot bind to data table with no name

Belwo I mention coding part I wrote

private void textBox1_TextChanged(object sender, EventArgs e)
        {
            DataView Dv = new DataView();
           
            DataTable D1 = new DataTable("Test");
            D1 = (DataTable)dataGridView1.DataSource;
            Dv.Table = D1;
            
            Dv.RowFilter = "SHOP_CODE Like '" + textBox1.Text + "%'";
            dataGridView1.DataSource= Dv;
        }

Recommended Answers

All 2 Replies

You overwrite D1 with datasource, therefore it has no table name.

Yes LizR has right, when you overwrite a given object it becomes completly new one

I suggest this tutorial for you but don't forget to rate it

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.