Hello,
I want to sort my array and I have a type mismatch
here is my code :
Dim tableau(1000) As String
…
…
For xyz = 0 To xx-1
Print tableau(xyz) <-- prints are ok
Next
Call SortArray2(tableau) <--- type mismatch
Function SortArray2 (Array$())
’ this code taken from Notes.net, and slightly modified to sort by numeric value
Dim MaxElement%, MidPoint%, I%, J%, Done%
MaxElement% = Ubound(Array$)
Select Case MaxElement%
Case 0
Exit Function
Case 1
If Cint (Array$(0)) > Cint (Array$(1)) Then
Swap Array$(0), Array$(1)
End If
Case Else
MidPoint% = MaxElement%
While MidPoint% > 0
MidPoint% = MidPoint% \ 2
Do
Done% = True
For J% = 0 To MaxElement% - MidPoint%
I% = J% + MidPoint%
If Cint (Array$(J%)) > Cint (Array$(I%)) Then
Swap Array$(J%), Array$(I%)
Done% = False
End If
Next
Loop Until Done%
Wend
End Select
End Function
Function Swap (A$, B$)
’ goes w/ SortArray which was taken from notes.net
Dim Temp$
Temp$ = A$
A$ = B$
B$ = Temp$
End Function