c# - Open File Which is already open in window explorer -
i trying open file using openfiledialog
.
if (openfiledialog1.filename != "" && resultsavedialog == system.windows.forms.dialogresult.ok) { openfiledialog1.openfile(); // throw exception here txtfilename.text = openfiledialog1.safefilename; }
but if file opened in window explored throws me following exception
the process cannot access file 'd:\projects\cdr_raw_files\groupdata\8859511378.xls' because being used process.
is possible open file using openfiledialog
if file has opened in window explorer.
ok, if need selected file name , path, try below, you...
if (openfiledialog1.filename != "" && resultsavedialog == system.windows.forms.dialogresult.ok) { string path = path.getdirectoryname(openfiledialog1.filename); string filename = path.getfilename(openfiledialog1.filename); txtfilename.text = filename; }
Comments
Post a Comment