by aditya risbud (1 Submission)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 26th July 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This will sort an dynamic array
API Declarations
Dim max As Integer, i As Integer, j As Integer, so As Integer, textlength As Integer
textlength = Len(Text1.Text)
ReDim Preserve alltext(textlength)
ReDim Preserve sort(textlength)
For i = 1 To textlength
alltext(i) = Mid(Text1.Text, i, 1)
Next
For j = 1 To textlength
For i = 1 To textlength
If alltext(max) > alltext(i) Then
max = i
End If
Next
sort(so) = alltext(max)
alltext(max) = Chr(225)
so = so + 1
max = so
Next
For i = 1 To textlength
Text2.Text = Text2.Text + sort(i)
Next
End Sub
Private Sub Form_Load()
max = 1
so = 1
Load Form2
Form2.Show
Form2.Hide
End Sub