34,333
edits
Changes
no edit summary
<tr>
</table>
With the following options in mind, the following code excerpt opens 'C:\Temp\text.txt' in ''FileMode.OpenOrCreate'' with FileAccess.ReadWrite permission and no file sharing, and then closes it:
<pre>
Dim textFileStream As New IO.FileStream("C:\Temp\test.txt", IO.FileMode.OpenOrCreate,
IO.FileAccess.ReadWrite, IO.FileShare.None)
textFileStream.Close()
</pre>
Note that the above code example assumes that the 'C:\Temp' directory already exists. If it does not the code will fail. Working with Directories is covered in [[Working with Directories in Visual Basic]]
== Writing to a File ==