Changes

Jump to: navigation, search

Working with Files in Visual Basic

607 bytes added, 15:50, 10 August 2007
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 ==

Navigation menu