Public Class frmSort

  Private Sub btnSort_Click(ByVal sender As System.Object,
                            ByVal e As System.EventArgs) Handles btnSort.Click
    'Sort the file AgeAtInaug.txt by ages
    Dim agesAtInaug() As String = IO.File.ReadAllLines("AgeAtInaug.txt")
    Dim query = From line In agesAtInaug
                Let age = CInt(line.Split(","c)(1))
                Order By age
                Select line
    IO.File.WriteAllLines("Sorted.txt", query)
  End Sub

End Class
