This is a short example of how to read/write to a text file. I would suggest you read the documentation available at msdn, for more information.
Anyhow, I would use VBDT's way, it's simpler.
vb.net Code:
Private Sub Form1_FormClosing _
(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) _
Handles Me.FormClosing
'To write to the file you can do this
Dim _newscore As String = TextBox1.Text
IO.File.WriteAllText("filepath", "Your last score was" & TextBox1.Text)
'Another way of accomplishing the same thing is
Using writer As New IO.StreamWriter("filepath")
writer.WriteLine("Your last score was" & TextBox1.Text)
End Using
End Sub
Private Sub Form1_Load _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
'Note that ReadAllText returns a string with all the lines of
'a text file, so I'm assuming the file has one line...
Dim score As String = IO.File.ReadAllText("filepath")
'The other thing I'm assuming is that the file says something like
'Your last score was 1000! Nice!
MsgBox(score, MsgBoxStyle.Exclamation, "Highscore")
'Another way to read a text file is this
Using reader As New IO.StreamReader("filepath")
Dim _score As String = reader.ReadToEnd
TextBox2.Text = _score
End Using
End Sub