Here is how you go. Reverse the -1
and 1
part.
Public Function Compare(x As Object, y As Object) As Integer Implements System.Collections.IComparer.Compare
Dim item1 = CType(x, ListViewItem)
Dim item2 = CType(y, ListViewItem)
If item1.ForeColor = Color.Red And item2.ForeColor = Color.Red Then
Return 0
ElseIf item1.ForeColor = Color.Red And item2.ForeColor = Color.Black Then
Return -1
ElseIf item1.ForeColor = Color.Black And item2.ForeColor = Color.Red Then
Return 1
Else
Return 0
End If
End Function
Also note you're ignoring any other colors other than Black or Red. You may need to consider that.