This should start you off, I haven't tested it so it might be wrong...


VB Code:
  1. Dim NumberOfClicks As Integer = 31 'the variable youwant to write
  2.  
  3.     Sub WriteNumber()
  4.  
  5.         'to write text file
  6.         Dim myFile As StreamWriter = IO.File.CreateText("Your path here")
  7.         myFile.WriteLine(NumberOfClicks)
  8.         myFile.Close()
  9.  
  10.     End Sub
  11.  
  12.     Sub Readnumber()
  13.  
  14.         'to read it back in
  15.         Dim myFile As StreamReader = IO.File.OpenText("Your path here")
  16.         NumberOfClicks = Integer.Parse(myFile.ReadLine.Trim)
  17.         myFile.Close()
  18.  
  19.     End Sub

Note there is no error trapping for things like illegal files and so forth.