Hi,
In a parent subroutine with a Try/Catch I want to check if a file is open.
If the file is open then it seems to create an exception in the ?parent? routine which means that it doesn't continue with the code.
Is there any way to handle the exception in the subroutine so that it doesn't interfere with the parent?
And is the a term for a parent subroutine?
Code:Function IsFileOpen(ByRef FileName As String) As Boolean
Dim blnRetVal As Boolean = False
Dim fs As FileStream = Nothing
Try
fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.None)
Catch ex As Exception
blnRetVal = True
Finally
If Not IsNothing(fs) Then
fs.Close()
End If
End Try
Return blnRetVal
End Function

