Hi all,

I have a datagridview with a set of rows which look like

no.          name                value
1             X                    1
2             X                    1
3             X                    2
4             Y                    1
5             Y                    1

Now I want to filter the datagridview by value with respective to name and show only the best value under that name. For the above example I would expect my datagridview to show this:

no.          name                value

3             X                    2
4             Y                    1
5             Y                    1

Can anyone help me in solving this please ...

thanks

Hi, because you haven't mentioned how to add value to the Gridview I might not be able to help you too much. However the best way to filter the gridview is to use Dataview to filter the top values then add the filtered values to the gridview, this can be a good choice if the source of data coming from a database.

Also you can implement Icomparable and Icomparer interface to sort the values and select the top ones if you have a class for the no, name and value.

Hi, because you haven't mentioned how to add value to the Gridview I might not be able to help you too much. However the best way to filter the gridview is to use Dataview to filter the top values then add the filtered values to the gridview, this can be a good choice if the source of data coming from a database.

Also you can implement Icomparable and Icomparer interface to sort the values and select the top ones if you have a class for the no, name and value.

Hi,

Actually I have done it myself now everything seems to be good

Thanks

am i the only one who finds these "solutions" extremely frustrating? if you have gone through the trouble of posting the question in the first place, and you are the one with the solution, why not give the rest us who would like to know the answer the courtesy of posting it?

thanks

commented: Agreed +7
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.