all groups > dotnet windows forms > june 2007 >
You're in the

dotnet windows forms

group:

OpenFileDialog creates handle to a folder



OpenFileDialog creates handle to a folder Hayato Iriumi
6/27/2007 7:09:29 PM
dotnet windows forms: Hello, folks.
I have an issue with OpenFileDialog. Let's say I chose a file at C:
\TestFolder\TestFile.txt using OpenFileDialog. After I choose the
file, I tried to delete the folder from Windows Explorer, but it says
that another process is being used by another person or program.

So I opened up Process Explorer and checked my Windows application. I
found out that it was holding a handle to the folder that contains the
file I just chose. Whenever I use OpenFileDialog to choose a file, it
seems to create a handle to the folder. I can delete the folder when I
close the application or just close the handle from Process Explorer,
but I need to get around this issue programmatically.

So my question is how do I avoid creating a handle to the folder that
contains the file I chose from OpenFileDialog?
Re: OpenFileDialog creates handle to a folder Hayato Iriumi
6/27/2007 7:56:33 PM
After a few hours of poking around, found that RestoreDirectory should
be set to True.
I hope this helps people who are having the same issue.

[quoted text, click to view]

AddThis Social Bookmark Button