Guest User

Untitled

a guest
Aug 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. If IO.File.Exists("CityNames.txt") = True Then
  2. 'opening txt file to view
  3. inFIle = IO.File.OpenText("CityNames.txt")
  4.  
  5. 'Array Code
  6. Dim CityArray(5) As String
  7. Dim i As Integer = 0
  8.  
  9.  
  10. While inFIle.Peek <> -1
  11.  
  12. CityArray(i) = inFIle.ReadLine
  13. i += 1
  14. End While
  15. inFIle.Close()
  16.  
  17. 'instantiate StreamWriter
  18. outFile = IO.File.AppendText("CityNames.txt")
  19.  
  20. For intCount = 0 To CityArray.Length - 1
  21. outFile.WriteLine(CityArray(i))
  22.  
  23. Next
  24. 'close file
  25. outFile.Close()
  26.  
  27.  
  28.  
  29. Else
  30. 'Handles the contingency that the file is missing or corrupt
  31. MessageBox.Show("File does not exist")
  32. End If
Add Comment
Please, Sign In to add comment