Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting a file attribute
Message
De
11/03/2014 18:13:22
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Setting a file attribute
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01596185
Message ID:
01596185
Vues:
33
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform