Imports System
Imports System.IO
Module FileExample
Sub Main()
Dim FileName As String = "c:\test.xml"
Dim isReadOnly As Boolean = IsFileReadOnly(FileName)
SetFileReadAccess(FileName, True)
isReadOnly = IsFileReadOnly(FileName)
End Sub
Sub SetFileReadAccess(ByVal FileName As String, ByVal SetReadOnly As Boolean)
Dim fInfo As New FileInfo(FileName)
fInfo.IsReadOnly = SetReadOnly
End Sub
Function IsFileReadOnly(ByVal FileName As String) As Boolean
Dim fInfo As New FileInfo(FileName)
Return fInfo.IsReadOnly
End Function
End Module