[RESOLVED] How to sort a array
Hi, I am reading sets of data from a .txt file which has six entities of data in each row one of them is a date and I want a list box to read out each line of the file but in date order. :) :thumb:
Heres the current code:
Code:
Dim Driver(0 To 100) As String
Dim Team(0 To 100) As String
Dim CarNo(0 To 100) As String
Dim RaceDate(0 To 100) As String
Dim Venue(0 To 100) As String
Dim Position(0 To 100) As String
Private Sub Form_Load()
Dim Counter As Integer
Open "RacingData.txt" For Input As #1
Counter = 0
Do While Not EOF(1)
Input #1, Driver(Counter), Team(Counter), CarNo(Counter), RaceDate(Counter), Venue(Counter), Position(Counter)
lstDatabase.AddItem Driver(Counter)
Counter = Counter + 1
Loop
Close #1
End Sub
Private Sub lstDatabase_Click()
Dim PosOfChoice As Integer
PosOfChoice = lstDatabase.ListIndex
lblMatches.Caption = Matches(PosOfChoice)
lblWon.Caption = Won(PosOfChoice)
lblLost.Caption = Lost(PosOfChoice)
lblDrawn.Caption = Drawn(PosOfChoice)
lblPoints.Caption = Points(PosOfChoice)
End Sub