04-21-2010, 04:13 PM
So I have a form (form1) with a datagridview (datagridview1) which contains 8 columns (member#, mound#, name, age, range fee, gun hire, total, score), yes this is for a gun club.
I am having two problems when sorting the data (clicking on the column title),
firstly, when I try and sort a column which contains Integers only (score for example), when this order is sorted, this is how it is displayed :
1
100
150
25
30
300
Now obviously this isn't how I would like my data to be sorted, I want it in a logical way :
1
25
30
100
150
300
How would I go about changing the way in which the data is sorted? (this data is not bound to a database)
secondly, when I want the data to be sorted between two columns (age and score) this is what I get: (note J is junior and S is senior)
age - score
J - 100
J - 25
J - 150
S - 300
S - 1
S - 30
It is sorting the data by age, the the score column is being sorted in the order the row was added to the database, this is how I would like the data to be displayed :
age - score
J - 25
J - 100
J - 150
S - 1
S - 30
S - 300
Could anyone please explain how I could make the datagridview sort as shown above?
Many thanks
(data is hypothetical)
I am having two problems when sorting the data (clicking on the column title),
firstly, when I try and sort a column which contains Integers only (score for example), when this order is sorted, this is how it is displayed :
1
100
150
25
30
300
Now obviously this isn't how I would like my data to be sorted, I want it in a logical way :
1
25
30
100
150
300
How would I go about changing the way in which the data is sorted? (this data is not bound to a database)
secondly, when I want the data to be sorted between two columns (age and score) this is what I get: (note J is junior and S is senior)
age - score
J - 100
J - 25
J - 150
S - 300
S - 1
S - 30
It is sorting the data by age, the the score column is being sorted in the order the row was added to the database, this is how I would like the data to be displayed :
age - score
J - 25
J - 100
J - 150
S - 1
S - 30
S - 300
Could anyone please explain how I could make the datagridview sort as shown above?
Many thanks
(data is hypothetical)