After get FileStream and completing work on file stream you have to close FileSteram using Close method. to avoid any file open errors.
Here are example for this.
C# Example :
System.IO.FileStream stream1 = System.IO.File.Open(MapPath("TextFile.txt"), System.IO.FileMode.Open); stream1.Close();
VB.net Example :
Dim stream1 As System.IO.FileStream = System.IO.File.Open(MapPath("TextFile.txt"), System.IO.FileMode.Open) stream1.Close()
Here in below image you can see that after FileStream Object is filled it's properties are set.