I've searched the internet for a solution for my problem, me and my studygrp is making a datagridview that takes information from a classLibrary. All that works but now we got to filter it but all I can find is by bindingsource but that's not what I was thinking. I just want a simple filter so that you can enter something in a textbox and it shows it on the datagridview if it contains that information. I've tried:
((DataTable)dataGridView1.DataSource).DefaultView.RowFilter = "FromColumn like '%" + textBox1.Text + "%'";
But it doesn't work like I want it to hmmn... anyone that can help?
Try BindingSource. It provides good extensive facilities of filtering
BindingSource bs = new BindingSource();
bs.DataSource = dataGridView1.DataSource;
bs.Filter = "yourColumnName like '%" + textBox1.Text + "%'";
dataGridView1.DataSource = bs;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With