Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3666

Sorting speed

$
0
0

Thanks to your support, examples, info and code that you suggested, I was able to sort my listboxes using RowComparision. However, I noticed that in lists where there are several hundred rows the sorting is slow, it takes even several seconds to sort. Can the code be improved or some trick used to speed up the execution?

I also tried with this, but the substance does not change.

Select Case column
Case 3  'colonne con il tipo DATA
  Var n1 As DateTime
  Var n2 As DateTime
  Var olds As String
  Var lc As New locale("it-IT")
  if Me.CellTextAt(row1,column)<>"" then
    olds = Me.CellTextAt(row1,column)
    n1 = datetime.FromString(olds, lc)
    if Me.CellTextAt(row2,column)<>"" then
      olds = Me.CellTextAt(row2,column)
      n2= datetime.FromString(olds, lc)
      If N1 < N2 Then
        result = -1
      ElseIf N1 > N2 Then
        result = 1
      Else
        result = 0
      End If
    end if
  end if
  Return True
Else 'nulla, esco
  Return False
End select

I also tried with this, but the substance does not change.

Var  olds, news, bits() as String
olds = Me.CellTextAt(row1,column)
bits = olds.split (“/”)
news = bits(2) + “-” + bits(1) + “-” + bits(0)
n1 = DateTime.FromString(news)

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 3666

Trending Articles