Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

FileAttr Function

Returns an enumeration representing the file mode for files opened using the FileOpen function.

Public Function FileAttr(ByVal FileNumber As Integer) As OpenMode


Required. Integer. Any valid file number.


Exception type Error number Condition
IOException 52 FileNumber does not exist.
IOException 54 File mode is invalid.

Return Values

The following enumeration values indicate the file access mode:

Value Mode
1 OpenMode.Input
2 OpenMode.Output
4 OpenMode.Random
8 OpenMode.Append
32 OpenMode.Binary


This example uses the FileAttr function to return the file mode of an open file.

Dim mode As OpenMode
FileOpen(1, "c:\MYFILE.TXT", OpenMode.Input)
mode = FileAttr(1)
MsgBox("The file mode is " & mode.ToString())

Smart Device Developer Notes

This function is not supported.


Namespace: Microsoft.VisualBasic

Module: FileSystem

Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)

See Also

GetAttr Function | FileOpen Function | SetAttr Function | IOException Class

© 2015 Microsoft