FileClose Function
Concludes input/output (I/O) to a file opened using the FileOpen function.
Using My gives you greater productivity and performance in file I/O operations. See My.Computer.FileSystem Object for more information.
Public Sub FileClose(ParamArray FileNumbers() As Integer)
|
Exception type |
Error number |
Condition |
|---|---|---|
|
FileNumber does not exist. |
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.
The FileClose function is provided for backward compatibility and may affect performance. For non-legacy applications, the My.Computer.FileSystem object provides better performance. For more information, see File Access with Visual Basic.
If you omit FileNumbers, all active files opened by the FileOpen function are closed.
When you close files that were opened for Output or Append, the final buffer of output is written to the operating system buffer for that file. All buffer space associated with the closed file is released.
When the FileClose function is executed, the association of a file with its file number ends.
Namespace: Microsoft.VisualBasic
Module: FileSystem
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)