Hi everyone, I have to make a program that reads a txt file after reading it, show it in a richtext box and in another tab make the average of the grades the input received sort it by the student id and then in the same rtb sort it by the average of their grades, and finally save it on a new text file.

The text file input is something like this

12 3 10.0 6.9 7.3
19 2 6.7 9.3
10 3 4.5 9.3 4.5

and the output should look like this

sorted by student ID
10 6.1 4.5 9.3 4.5
12 8.1 10.0 6.9 7.3
19 5.3 6.7 9.3

sorted by grade average
12 8.1 10.0 6.9 7.3
10 6.1 4.5 9.3 4.5
19 5.3 6.7 9.3

As you noticed in the input the first number is the student ID, the second number is the number of tests made by the student, and the other 3 numbers are grades, in the output the first number is the student ID, the second number is the average of the tests, and the other 3 numbers are grades, but my problem is that I can't get the values from the list that I 've created, here is the code:

      Imports System.IO

      Public Class Form1

          Private Sub AbrirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AbrirToolStripMenuItem.Click

              ' Try

              Dim txtString As String()

              txtString = System.IO.File.ReadAllLines("C:\read.txt")

              ' Catch ioexception As IOException

              'MsgBox("File Not Found")

              Dim studentList As New System.Collections.Generic.Dictionary(Of Integer, Decimal())
              For Each line As String In txtString
                  If (String.IsNullOrEmpty(line)) Then
                      Continue For

                  End If

                  Dim data As String() = line.Split(" ")
                  Dim studentId As Integer = Convert.ToInt32(data(0))

                  Dim gradeList As New List(Of Decimal)

                  For i1 As Integer = 1 To data.Length - 1


                  studentList.Add(studentId, gradeList.ToArray())      


              'At this point I have it all in memory :)

             'this code should retrieve me the values but it doesn't

             'the error says that the key has not been found on the dictionary

              Dim value1 As Object

              value1 = studentList(1)

              RichTextBox1.Text = value1
              'End Try
          End Sub
thanks in advance I really appreciate all your help