Public Class frmPioneers

  Private Sub btnCreateFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateFile.Click
    'Create the file Pioneers.txt
    Dim sw As IO.StreamWriter = IO.File.CreateText("Pioneers.txt")
    sw.WriteLine("Atanasoff")
    sw.WriteLine("Babbage")
    sw.WriteLine("Codd")
    sw.WriteLine("Dijkstra")
    sw.WriteLine("Eckert")
    sw.WriteLine("Faggin")
    sw.WriteLine("Gates")
    sw.WriteLine("Hollerith")
    sw.Close()    'If this line is omitted, the file will be empty.
    MessageBox.Show("Names recorded in file", "File Status")
  End Sub

  Private Sub btnDisplayFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayFile.Click
    'Display the contents of the file Pioneers.txt in a list box
    Dim sr As IO.StreamReader = IO.File.OpenText("Pioneers.txt")
    lstNames.Items.Clear()
    Do Until sr.EndOfStream
      lstNames.Items.Add(sr.ReadLine)
    Loop
  End Sub

End Class
