Public Class frmJustices

  Private Sub btnReorganize_Click(ByVal sender As System.Object,
                                  ByVal e As System.EventArgs) Handles btnReorganize.Click
    'Take data from a text file. Sort and restructure the data, 
    'and display it in a table.
    Dim justices() As String = IO.File.ReadAllLines("Justices.txt")
    Dim query = From line In justices
                Let data = line.Split(","c)
                Let firstName = data(0)
                Let lastName = data(1)
                Let yrAppointed = CInt(data(4))
                Let fullName = firstName & " " & lastName
                Order By yrAppointed, firstName
                Select fullName, yrAppointed
    dgvOutput.DataSource = query.ToList
    dgvOutput.CurrentCell = Nothing
  End Sub

End Class
