I'm writing some software in C Sharp and I'm having trouble. I am using an OpenFileDialog to get the location of a file. I do not actually open the file and read or write to it, I just need its address. When I go to open said file the "File in use error" pops up and wont let me proceeded with my selected file. Is there a way I can make the dialog ignore this message.
Asked
Active
Viewed 364 times
0
-
can you show some code? – Neel Sep 12 '15 at 08:44
-
You should close the file before proceeding with that.. that file is in use with some other program.. so close it first.. – Amnesh Goel Sep 12 '15 at 08:46
-
Read this link may help [Selecting files][1] [1]: http://stackoverflow.com/questions/24449988/how-to-get-file-path-from-openfiledialog-and-folderbrowserdialog – Ramankingdom Sep 12 '15 at 08:56
1 Answers
3
I figured it out.
by setting the OpenFileDialog.ValidateNames to false. It skipped the pop up. This should be fine because I'm not actually opening the file. Just closing the dialog box and storing the file path.

ThatOneGuy
- 41
- 2