DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Tto find out a File is already opened

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Tto find out a File is already opened

    [Originally posted by Rao]

    Hi All,
    How do I found out that a file is already opened or not. Is there any property to get these details? Please help.
    Any help is appreciated.
    Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Tto find out a File is already opened

    [Originally posted by bgong68]

    Hi,
    I have 2 ideas for you.
    1. If a file is already opened you will get an error number 55 so you can do something like this.

    On Error GoTo Error_Trap:
    '*************************************************
    ' "Your_Filename_Here" should represent your
    ' actual file name
    '*************************************************
    Open "Your_FileName_Here" For Binary As 1
    MsgBox "File Opened"
    Error_Trap:
    If Err = 55 Then
    '*************************************************
    ' you can insert your code here to handle the
    ' file that is already opened
    '*************************************************
    MsgBox "File Already Opened"
    End If


    2. You can use the Close statement without a file number to close all active files before you attempt to open your file. So you could do something like this.


    Close
    Open "Your_FileName_Here" For Binary As 1


    I hope this helps,
    Barry



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center