A
Andy Janssen
First off, is there such a thing as a common dialog that allows a user to select a directory? (I don't think so). Is there any standard way to do so?
Second question. Why does the FileDialog lock down directories contianing the file that the user selects?
Ex:
Directory.Move("C:\\test dir", "C:\\test dir moved"); //Move a file
Directory.Move("C:\\test dir moved", "C:\\test dir"); //Move it back
FileDialog dlg = new OpenFileDialog();
dlg.ShowDialog(this);
// (User selects a file inside c:\test dir\)
// Now let's try to make dlg let go of all handles.
dlg.FileName = "";
dlg.Reset();
dlg.Dispose();
dlg = null;
GC.Collect(); // The dlg object had better be gone by this point!
Directory.Move("C:\\test dir", "C:\\test dir moved");
The first two Directory.Move operations work fine. The last one tells me that the directory "C:\test dir" is in use. What's going on? I realize that this could be some sort of safety or something, but what event turns the directory lock off? I garbage collect the freaking thing! How much more do you want from me!? lol.
Thanks guys.
-Andrew Janssen
Second question. Why does the FileDialog lock down directories contianing the file that the user selects?
Ex:
Directory.Move("C:\\test dir", "C:\\test dir moved"); //Move a file
Directory.Move("C:\\test dir moved", "C:\\test dir"); //Move it back
FileDialog dlg = new OpenFileDialog();
dlg.ShowDialog(this);
// (User selects a file inside c:\test dir\)
// Now let's try to make dlg let go of all handles.
dlg.FileName = "";
dlg.Reset();
dlg.Dispose();
dlg = null;
GC.Collect(); // The dlg object had better be gone by this point!
Directory.Move("C:\\test dir", "C:\\test dir moved");
The first two Directory.Move operations work fine. The last one tells me that the directory "C:\test dir" is in use. What's going on? I realize that this could be some sort of safety or something, but what event turns the directory lock off? I garbage collect the freaking thing! How much more do you want from me!? lol.
Thanks guys.
-Andrew Janssen