Mega Code Archive

 
Categories / VB.Net / File Directory
 

Stream CanWrite Property tells whether the current stream supports writing

Imports System Imports System.IO Class TestRW         Public Shared Sub Main()         Dim fs As New FileStream("MyFile.txt", FileMode.OpenOrCreate, _            FileAccess.Write)         If fs.CanRead And fs.CanWrite Then             Console.WriteLine("MyFile.txt can be both written to and read from.")         Else             If fs.CanWrite Then                 Console.WriteLine("MyFile.txt is writable.")             End If         End If     End Sub End Class