Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[VB.NET]Give file an attribute

originally posted on dotnet-snippets.com

Description:

With this function you can give a file an attribute like ready-only.

Code
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

If You Like this tutorial, please check out my other tutorials by clicking ==> H3R3
PHP & .NET Contributor.
you can always just use 1 line of code
File.SetAttributes(FileName, Attribute)

thankz for sharing!
:)
true but this is the proper way of doing it.
PHP & .NET Contributor.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by milkpopAug 22, 2018 05:14 AM 2 125 Aug 22, 2018 05:14 AM
Last Post: ⁠Cammy
[.NET] by NyQuilJun 22, 2017 10:23 AM 12 350 Jun 22, 2017 10:23 AM
Last Post: Aristocles
[C#] by severosJun 30, 2016 12:47 AM 3 535 Jun 30, 2016 12:47 AM
Last Post: caesay