How to filter DataGridView in C# Win Forms?

后端 未结 3 571
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-16 07:48

Guys I have created a simple datagridview through toolbox and selected data through wizard (no code in .cs file) from database. It is working flawlessly as you can see in th

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 07:59

    I hope I got your problem well

    string whereClause = "ContactPerson=" +textbox.text;
    (datagridview.DataSource as DataTable).DefaultView.RowFilter = whereClause;
    

提交回复
热议问题