Resolved Sorting DataGridView

aaaron123@roadrunner.com

Well-known member
Joined
Jan 23, 2011
Messages
127
Programming Experience
10+
This seems so simple a question I was sure I could find out myself be reading.
But I haven't.

So I experimented with, for example,
System.String.Compare and System.String.CompareOrdinal

I'm sorting a DataGridView using:
Handles DataGridView1.SortCompare

I want Beatles and BEatles to appear on adjecent rows.

Is that possble?
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,589
Location
Norway
Programming Experience
10+
Do you have an example where you don't get the result you want, and how that should ideally sort?
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,589
Location
Norway
Programming Experience
10+

aaaron123@roadrunner.com

Well-known member
Joined
Jan 23, 2011
Messages
127
Programming Experience
10+
Do you have an example where you don't get the result you want, and how that should ideally sort?

Using as something to try:
e.SortResult = System.String.Compare(e.CellValue1.ToString.ToLower, e.CellValue2.ToString.ToLower)
I get:

I got similar results without the ToLower and either System.String.Compare and System.String.CompareOrdinal

I'd like the top and bottom rows next to each other,

1641405307932.png
 

aaaron123@roadrunner.com

Well-known member
Joined
Jan 23, 2011
Messages
127
Programming Experience
10+

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,589
Location
Norway
Programming Experience
10+
That image is sorting on Count, not Artist.
 
Top Bottom