Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting a file attribute
Message
From
11/03/2014 18:13:22
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Setting a file attribute
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01596185
Message ID:
01596185
Views:
32
Can someone see something wrong in that code? It works to remove file attributes. But, I cannot set an attribute:
        ' Based on the attribute
        Select Case nAttribute

            ' Readonly
            Case FileAttribute.ReadOnly

                ' If we have to add it
                If lAttribute Then
                    File.SetAttributes(cFile, loFileAttribute And FileAttributes.ReadOnly)
                Else
                    File.SetAttributes(cFile, loFileAttribute And Not FileAttributes.ReadOnly)
                End If

                ' System
            Case FileAttribute.System

                ' If we have to add it
                If lAttribute Then
                    File.SetAttributes(cFile, loFileAttribute And FileAttributes.System)
                Else
                    File.SetAttributes(cFile, loFileAttribute And Not FileAttributes.System)
                End If

                ' Hidden
            Case FileAttribute.Hidden

                ' If we have to add it
                If lAttribute Then
                    File.SetAttributes(cFile, loFileAttribute And FileAttributes.Hidden)
                Else
                    File.SetAttributes(cFile, loFileAttribute And Not FileAttributes.Hidden)
                End If

        End Select
The code goes in the right line but it has not effect on the file properties.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform