VB - Give file an attribute

By , 4/9/2008
(1 ratings)
With this function you can give a file an attribute like ready-only.
Translate to C#
Public Sub SetAttribute(ByVal FileName As String, ByVal NewAttribute As FileAttribute)
    Dim Attr As FileAttributes
    Attr = File.GetAttributes(FileName)
    File.SetAttributes(FileName, Attr Or NewAttribute)
End Sub

Tagged with attribute, file.

Comments

 

Log in, to comment!