Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. 'Dim lines() As String = {"This is some random text", "saved to a file"}
  2.  
  3. 'Dim mydocpath As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
  4.  
  5. 'Using outputFile As New StreamWriter(mydocpath & Convert.ToString("\randomtext.txt"))
  6. ' For Each line As String In lines
  7. ' outputFile.WriteLine(line)
  8. ' Next
  9. 'End Using
  10.  
  11. 'Using outputFile As New StreamWriter(mydocpath & Convert.ToString("\randomtext.txt"), True)
  12. ' outputFile.WriteLine("Here is more info")
  13. 'End Using
  14.  
  15. 'Try
  16. ' Using sr As New StreamReader(mydocpath & Convert.ToString("\randomtext.txt"))
  17.  
  18. ' Dim line As String
  19.  
  20. ' line = sr.ReadToEnd()
  21. ' txtOutput &= line & Environment.NewLine
  22. ' End Using
  23. 'Catch ex As Exception
  24.  
  25. ' MessageBox.Show("Couldn't read file", "Error")
  26.  
  27. 'End Try
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement