Results 1 to 3 of 3

Thread: [RESOLVED] How to sort a array

  1. #1

    Thread Starter
    Addicted Member seditives's Avatar
    Join Date
    Jan 2011
    Location
    South of England
    Posts
    151

    Resolved [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.

    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

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: How to sort a array

    In the CodeBank you can find this thread by Ellis Dee. It has examples of several different types of sorting algorithms.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Addicted Member seditives's Avatar
    Join Date
    Jan 2011
    Location
    South of England
    Posts
    151

    Re: How to sort a array

    Quote Originally Posted by LaVolpe View Post
    In the CodeBank you can find this thread by Ellis Dee. It has examples of several different types of sorting algorithms.
    chears TheFox

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width