Hi, DaniWeb members,
Recently i've been developing a progam that will read in a player database that is stored in plain text if the folling format
name ,age,score,date played
So far i have managed to read in the file and caculate the number of players in the database by
Do Until EOF(1) aboutPlayer = LineInput(1) ' For Each line In aboutPlayer numPlayers = numPlayers + 1 playerDeatils = aboutPlayer.Split(",") If EOF(1) Then 'Removes the top line counting as a player numPlayers = numPlayers - 1 End If Loop
The program so far dose
1: read in text file
2: count the number of lines
3: -1 for the header
4: split lines into sigle lines
And also manged to turn all the lines that have been read into single lines using the playerDetails = aboutPlayer.split(",")
So im woundering how to trun these split lines into an array of records.
I do have a base structure in place for single elementes to be stored, the problem is how to turn the stringsplit into the array of records within the structure.
Module Module1 'Describe the information read in form the "playerDB.txt" Structure playerInfo Dim Name As String Dim Age As String Dim Score A String Dim datePlayed As String End Structure Public aboutPlayer As String Public playerDeatils As String Public numPlayers As Long = 0 Public onPlayer(0 To numPlayers) As playerInfo Public Player As Short = 0 End Module
Any help will be appricated
I havent used DaniWeb for a while, so this post will be edited a few times to use the code snippit tools correctly and clean up the layout