Hi Guys, Firstly, Happy New Year!!
Second, here my first query of the new year:

I am using a stored proceedure to retrieve records from a database that match a number of search parameters. I now want to show a subset of those records in my Datagridview. I don't, however, want to alter the stored proceedure. I cant see any clean way to add the new parameter : /

I decided to affect the subsets by hiding rows in the datagridview. I did this in the RowsAdded event. However, i have noticed something odd. Everything works fine except for one row. I set its .visible property to false but i can still see it : / Also, the RowsAdded event fires twice..the first time it adds the single problem row, the second time it adds the remaining 1940-odd rows.

SO, why is it adding this row seperatelty and why is it showing in the datagridview regardless of its .visible property??

Recommended Answers

All 2 Replies

You can add a rowfilter to the default view of the DataTable :

gridTable.DefaultView.RowFilter = "CompanyName < 'I'";
commented: fast response and exactly what i needed. Thanks :) +1

WOW! Cant believe i've been messing around trying to manually hide the rows *palms forehead*

I applied the filter to the BindingSource and it shows/hides the rows perfectly..Really responsive too. Thanks again sknake :)

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.