Click here to Skip to main content
15,911,711 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
Hi
I have created a form in c#, have 2 buttons,First button is to access an application (.exe file) which I developed using matlab,after the execution of the application,the data should be saved to the text file.

2nd button is to see the data (which is saved in above text file)in textbox

When I click the 1st button,the .exe file runs and I can able to see the .exe file.If I close the application,and click the 2nd button,an error is coming,

Error:the-process-cannot-access-the-file-because-it-is-being-used-by-another-process

How to fix the issue

Regards
Posted
Comments
[no name] 30-Apr-14 16:50pm    
Close the other process that has the file opened.

This thing is pretty easy to investigate. Please see my past answer: how to compress the error 'it is already used by another process' in vb.net[^].

—SA
 
Share this answer
 
Comments
phil.o 30-Apr-14 18:24pm    
Compressing errors? Interesting concept :)
Sergey Alexandrovich Kryukov 30-Apr-14 18:43pm    
Indeed. All questions to the author of this question. :-)
Thank you.
—SA
Member 10415564 30-Apr-14 22:24pm    
Thanks for your suggestion.

I have checked my matlab code ,where I close the file at the end of the file using fclose command.How cant I access that file if I close the respective .exe file .Can you show the code,since I am a beginner
Sergey Alexandrovich Kryukov 1-May-14 1:27am    
What code? This is your who has code causing that problem, not me. If you can present a code sample, short but comprehensive, to reproduce your problem, it would really help. But first, use my advice and identify the point of blocking the access.
—SA
The error is pretty clear. Something still has a handle on the file. Perhaps it's your code or perhaps you opened it to verify it was there.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900