SetAttr Function
Sets attribute information for a file.
The My feature gives you greater productivity and performance in file I/O operations than SetAttr. For more information, see My.Computer.FileSystem Object.
Public Sub SetAttr( _ ByVal PathName As String, _ ByVal Attributes As FileAttribute _ )
The Attributes argument enumeration values are:
|
Value |
Constant |
Description |
|---|---|---|
|
Normal |
vbNormal |
Normal (default). |
|
ReadOnly |
vbReadOnly |
Read-only. |
|
Hidden |
vbHidden |
Hidden. |
|
System |
vbSystem |
System file. |
|
Volume |
vbVolume |
Volume label |
|
Directory |
vbDirectory |
Directory or folder. |
|
Archive |
vbArchive |
File has changed since last backup. |
|
Alias |
vbAlias |
File has a different name. |
Note:
|
|---|
|
These enumerations are specified by the Visual Basic language. The names can be used anywhere in your code in place of the actual values. |
|
Exception type |
Error number |
Condition |
|---|---|---|
|
PathName invalid or does not exist. |
||
|
Attribute type is invalid. |
See the "Error number" column if you are upgrading Visual Basic 6.0 applications that use unstructured error handling. (You can compare the error number against the Number Property (Err Object).) However, when possible, you should consider replacing such error control with Structured Exception Handling Overview for Visual Basic.
Namespace: Microsoft.VisualBasic
Module: FileSystem
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
Note: