Using sw As New System.IO.StreamWriter("path\to\file.txt") sw.WriteLine("Hello world") End Using
The use of a Using block is recommended good practice when using an object that Implements IDisposable
Using
IDisposable