I try to open a folderitem file that is not nil, that exist but the file is allready open !!
Dim t As TextOutputStream
Dim f As FolderItem
f = GetSaveFolderItem("", "CreateExample.txt")
If f <> Nil Then
t = TextOutputStream.Create(f)
As you can imagine, I will get an ioexception error 32.
HOW can I force the file to close before create my TextOutputStream ???
Capture the IO Error with TRY/CATCH and deal with it gracefully.
dave… any sample??? never try using try/catch before
Sure I did it. to catch the IO Error.
But My question is :
HOW can I force the closing of this file opened when I catch the error??
I don’t believe you will be able to close the file when you catch the error since that could involve closing the other program accessing the file, which you won’t be able to do. When you catch the IO Error, I would recommend you politely inform the user that the file is being used by another program and must be closed before it can opened by your program. I would recommend against indiscriminately closing the other applications the user has open so you can access the file.