TRI D'UN OBJET GRID À PARTIR D'UNE COLONE RÉFÉRENTE
tdihedi
Messages postés3Date d'inscriptionmardi 6 avril 2004StatutMembreDernière intervention 4 mai 2004
-
4 mai 2004 à 14:24
tdihedi
Messages postés3Date d'inscriptionmardi 6 avril 2004StatutMembreDernière intervention 4 mai 2004
-
4 mai 2004 à 17:48
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.
4 mai 2004 à 17:48
Grid.Sort = 1
c'est beaucoup plus rapide
4 mai 2004 à 14:24
Si vous essayez ce code vous allez voir qu'il ya quelques bugs:
par exemple le fait que la ligne de titre soit incluse
voici le code modifié:
Private Sub SortedGrid(ByVal Col As Integer)
Dim ct As Integer, ct2 As Integer, swapRow As Integer
Dim curVal, oldVal
Dim Change As Boolean
If Col < 0 And Col > Grid.Cols - 1 Then Exit Sub
Change = True
Do While Change
Change = False
For ct = Grid.Rows - 1 To Grid.FixedRows Step -1
Grid.Row = ct
Grid.Col = Col
oldVal = Grid.Text
swapRow = ct
For ct2 = ct To Grid.FixedRows Step -1
Grid.Row = ct2
Grid.Col = Col
If oldVal < Grid.Text Then
Call SwapRowGrid(swapRow, ct2)
swapRow = ct2
Change = True
ElseIf oldVal > Grid.Text Then
Exit For
End If
Next
Next
Loop
End Sub