我尝试了下面的代码,但它不起作用。怎么了?
private void textBox1_TextChanged(object sender, EventArgs e)
{
// DataView component
DataView view = new DataView();
view.Table = database1DataSet1.Tables["sample"];
view.RowFilter = "surname LIKE '%" + textBox1.Text + "%'";
}
答案 0 :(得分:0)
我认为您需要在设置view.RowFilter后添加以下行:
DataGridView1.DataSource = view;