当应用程序在c#中运行时如何从文本文件中读取数据 [英] How to read data from the text file when an application runs in c#

查看:131
本文介绍了当应用程序在c#中运行时如何从文本文件中读取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在c#中创建了一个表单,有2个按钮,第一个按钮是访问我使用matlab开发的应用程序(.exe文件),执行后应用程序,数据应保存到文本文件。



第二个按钮是在文本框中查看数据(保存在上面的文本文件中)



当我单击第一个按钮时,.exe文件运行,我可以看到.exe文件。如果我关闭应用程序,然后单击第二个按钮,则出现错误即将到来,



错误:进程无法访问文件,因为它正在被另一个进程使用/>


如何解决问题



问候

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

推荐答案

这件事很容易调查。请参阅我以前的回答:如何在vb.net中压缩错误'它已被另一个进程使用' [ ^ ]。



-SA
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


错误非常清楚。有些东西仍然有文件处理。也许这是你的代码,或者你打开它来验证它是否存在。
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.


这篇关于当应用程序在c#中运行时如何从文本文件中读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆