Click here to Skip to main content
15,903,030 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All,
Hello and hope you all doing well.
Im working in a project in vb.net and need to get the rank of column in another column in DataGridView by clicking a Button, the sort is doesn't matter just need the ranking value in the new column.
Thanks in advance.

What I have tried:

Sorry i didn't tried anything because i am stuck in this and i don't know what to do.
Posted
Updated 24-Jun-17 7:46am
v2
Comments
RickZeeland 24-Jun-17 13:36pm    
What exactly do you mean with "rank", are you using an SQL database ?
Member 13249229 24-Jun-17 14:38pm    
I Have a datagridview with 4 columns, first column is id, 2nd and 3rd i did some calculation by using other datagridviews, but i need to get the 3rd column rank values in 4th column. i dont use any databases.

1 solution

In order to get the rank of an item you will have to sort the data in the column.

As you do not want to sort the gridview;

1. copy the column data to an array
2. sort the array
3. walk the gridview rows and find the index of the column in the array and put that into the rank column.
 
Share this answer
 
Comments
RickZeeland 24-Jun-17 14:53pm    
Amazed someone understands what this is all about, 5d from me :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900