title: Identifying if a JPG file is open
body: <p>I've been trying to set an error trap that will detect if a file is already open. This is no problem when the file is a text file using the following code:</p>
  
  <p>Private Function FILEOPEN(ByVal sFile As String) As Boolean</p>
  
  <pre><code>    Dim THISFILEOPEN As Boolean = False
      Try
          Using f As New IO.FileStream(sFile, IO.FileMode.Open)
              THISFILEOPEN = False
          End Using
      Catch
          THISFILEOPEN = True
      End Try
      Return THISFILEOPEN
  End Function
  </code></pre>
  
  <p>My problem is that when the file is an open JPG file, not a text file, the above function returns False indicating that it is not open? I have tried different variations of the function but still cannot find a function that can tell if a JPG file is open.</p>