Sign In | Subscribe

Enter your Sign on user name and password.

Forgot password?
  • Follow us on:
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Visual Basic
  • Discussion

  • Study Guides

  • Table of Contents

Lecture Comments (3)

2 answers

Last reply by: David Llewellyn
Mon Jul 28, 2014 10:14 PM

Post by David Llewellyn on July 26, 2014

There seems to be a mismatch between the video and audio in this lecture. as this is a fairly complex section, can this be fixed?

Reading & Writing Files

  • being able to save values between executions of your programs is key to creating useful, reusable programs
  • .WriteAllText and .ReadAllText are the simplest way of saving and restoring text in files
  • StreamWriter and StreamReader allow text to be read or written a little at a time, instead of all at once
  • Remember to .Flush and .Close your files!
  • Path.Combine is the safest way to create file path strings
  • .GetFiles and .GetFolders allow you to simply access file and folder names
  • FileInfo exposes information about a file, such as:
    • Extension
    • FullName
    • Length
    • CreationTime and LastAccessTime
  • .CopyTo copies a file from one place to another
  • If you want to move a file, use .CopyTo to copy it first, then use .Delete to delete the original
  • .GetTempFileName allows you to use temporary files without having to worry about cleaning up after they are no longer needed