hello, I am trying to write a vb.net programme that reads data from a file and do a count for each column as shown in the format below and also write to an output file.
i am able to do the count but i am unable to write the output base on the resturants & days.

From what i have, i can only write the total sum from the array index. Here is the format of the file for better understanding and what i have done so far. Note; treat me as a newbie

File Format is
001,1,5,6,21
001,1,5,6,21
001,1,5,6,21
001,1,10,12,18
001,2,5,6,19
001,2,8,9,19
001,2,6,19,21
001,2,5,6,21
001,3,7,12,18
001,3,8,12,19
001,3,7,12,18
040,4,7,12,18
040,4,7,12,18
040,4,7,12,18
040,4,9,12,19

key
the format is 001 is restaurant 1, then day 1, then foods eaten by a particular customer (there up to 23 different kinds of food).
expected output is count of food eaten in each resturant in each day by a customer e.g

Restaurant day Rice Beans Yam Meat Snacks
001 1 50 20 2 0 0
001 2 0 21 0 5 7

My Code is

Dim IntSubjectArray(23) As String

 OpenFileDialog1.ShowDialog()

 strInputPath = OpenFileDialog1.FileName

 FileOpen(IntInputFileName, strInputPath, OpenMode.Input)

    Do While Not EOF(IntInputFileName)

        Dim StrReadLine As String = LineInput(IntInputFileName)

        Dim StrSplitRecord() As String = Split(StrReadLine, ",")

        IntRestaurant = StrSplitRecord(0)

        IntDay = StrSplitRecord(1)

        Meal1 = StrSplitRecord(2)

        Meal2 = StrSplitRecord(3)

        Meal3 = StrSplitRecord(4)

        If SaveDay <> IntDay Then

           IntMealArray(meal1) += 1

            IntMealArray(meal2) += 1

            IntMealArray(meal3) += 1

            SaveDay = IntDay

            SaveDay = 0

        End If

        savetown = IntExamTown

    Loop

    Call WriteOutputArray()

    FileClose(IntInputFileName)

    MessageBox.Show("File written to specified location")

End Sub

Public Sub WriteOutputArray()

IntOutputFileName = FreeFile()

For Each Array As String In IntMealArray

FileOpen(IntOutputFileName, "C:\Users\ireport\foodCount.txt", OpenMode.Append)

WriteLine(IntOutputFileName, IntMealArray(Array))

FileClose(IntOutputFileName)

Next

End Sub

End Class