S
sam
OpenFileDialog appears to be "holding onto" the parent folder of a
selected file until the application using the dialog quits.
After creating a folder containing a file, I attempted to select that
file with an OpenFileDialog. I used the following code to create the dialog:
Dim a As New OpenFileDialog
a.ShowDialog()
a.Dispose()
When the OpenFileDialog appears, navigate to the file within the folder
and click “Open”.
Leaving the application still running, attempt to delete the Folder
containing this file. On my machine, it fails with “Cannot delete
'myfoldername': It is being used by another person or program"...
Why is this? I haven’t attempted to actually open the file; merely
selected it. It appears as though the OpenFileDialog box is holding onto
the containing folder until the application is closed, afterwhich the
folder can be deleted. Disposing of the OpenFileDialog doesn’t seem to
help either. However, the actual selected file is not being locked--only
the parent folder.
Any ideas what might be causing this?
selected file until the application using the dialog quits.
After creating a folder containing a file, I attempted to select that
file with an OpenFileDialog. I used the following code to create the dialog:
Dim a As New OpenFileDialog
a.ShowDialog()
a.Dispose()
When the OpenFileDialog appears, navigate to the file within the folder
and click “Open”.
Leaving the application still running, attempt to delete the Folder
containing this file. On my machine, it fails with “Cannot delete
'myfoldername': It is being used by another person or program"...
Why is this? I haven’t attempted to actually open the file; merely
selected it. It appears as though the OpenFileDialog box is holding onto
the containing folder until the application is closed, afterwhich the
folder can be deleted. Disposing of the OpenFileDialog doesn’t seem to
help either. However, the actual selected file is not being locked--only
the parent folder.
Any ideas what might be causing this?