Hi All,
I am working on a Yahtzee projeect for college and am struggling with reading and writing to a csv file the code i have to read the file works but only gets the first column and displays it on a line not as a list.
the other criteria i have to work towards and wondering if anyone can help is to limit the amount of records to 10 so need to check what the lowest score is and if the current score is higher over write it, any help would be appriciated.
Regards
Aidan
I am working on a Yahtzee projeect for college and am struggling with reading and writing to a csv file the code i have to read the file works but only gets the first column and displays it on a line not as a list.
VB.NET:
Private Sub HighScoreFrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListView1.Columns.Add("ID")
ListView1.Columns.Add("User")
ListView1.Columns.Add("Score")
ListView1.GridLines = True
Using TFP As New FileIO.TextFieldParser(Application.StartupPath & "\Score.csv")
TFP.TextFieldType = FileIO.FieldType.Delimited
TFP.SetDelimiters(",")
While Not TFP.EndOfData
Try
Dim CR As String() = TFP.ReadFields()
Dim lvi As New ListViewItem(CR)
ListView1.Items.Add(lvi)
Catch ex As Exception
MessageBox.Show("Cannot parse file." + ex.Message)
End Try
End While
End Using
End Sub
the other criteria i have to work towards and wondering if anyone can help is to limit the amount of records to 10 so need to check what the lowest score is and if the current score is higher over write it, any help would be appriciated.
Regards
Aidan