Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
My problem is that am creating a school management system.
I want the software to be like the moment you select the class it displays the name,total marks scored in exams and lastly positions.

And I've tried to do all these. But my problem here now is how do I check and see the highest total marks and appoint a position like 1st,2nd,3rd.

Let's say if datagridview's column 1 is having these values
10
12
56
93.
Then on the next column2, I want the program to check for the higher total mark in column 1 and appoint a 1st to the higher mark, 2nd to the next higher mark, 3rd to next higher mark to the last mark. Where I want the 3rd,1st,2nd... display in column 2 but it will be in respective of what is in column

Please help me out
Posted
Comments
PIEBALDconsult 23-Jan-16 11:01am    
Ideally, the data is stored in a proper database. If the database is in SQL Server, you can use the ROW_NUMBER function to provide those values.
If not, you'll need to write some code to fill that column.
Richmond Boateng 23-Jan-16 11:19am    
It's like arranging student's positions, you will give the 1st position to student with the highest total marks, 2nd position for the student with the second highest total marks in that order. So I would like the position to be in the column 2
PIEBALDconsult 23-Jan-16 11:58am    
Yes, I know, but you don't provide enough information to allow us to provide much assistance and we're unlikely to write code for you even if you do.
Richmond Boateng 23-Jan-16 12:53pm    
btnload_Click()

dim max As integer

For each rw as DatagridviewRow in DGV.Rows

If rw.Cells("Column 1").Value = Max Then

rw.Cells("Column 2").Value = 1st,2nd,3rd,4th,5th

End if
Next



That is my code so far. But it isn't working
PIEBALDconsult 23-Jan-16 14:13pm    
Once the data is in the DataGridView it's too late -- you need to assign the values _before_ that.
Is or is not the data stored in a database?

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