文件在其他程序中打开,无法保存 [英] File open in other program, can't be saved

查看:148
本文介绍了文件在其他程序中打开,无法保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



基本上它是一个IU,用户可以通过记事本打开文本文件。

然后用户假设:

*更改文本文件中的一些值

*通过记事本保存文档

*返回UI。



问题是文档无法保存,因为文件在其他程序中打开且无法保存。 (翻译错误按摩)



有没有办法解决这个问题。

我已经删除了下面的代码。



  Dim  ProcessProperties  As   ProcessStartInfo 
Dim myProcess As 处理
reader.close()
ProcessProperties.FileName = notepad.exe
ProcessProperties.Arguments = lblCurrentFilePath
ProcessProperties.WindowStyle = ProcessWindowStyle.Normal
myProcess = Process.Start(ProcessProperties)
myProcess.WaitForExit()
myProcess .Kill()
OpenFileDialog1_FileOk(bFileEditM,AcceptButton)





祝你好运



我尝试过:



不多,只有上面的代码。不知道任何解决方案。

解决方案

如果记事本无法保存文件,那是因为您的应用程序打开了文件,另一个应用程序打开了该文件共享读取但不写入,或者用户没有权限在其所在的文件夹/位置中写入文件,例如C:的根目录或某个地方的Program Files,或者权限保护的其他位置。 / BLOCKQUOTE>

Hi all,

Basically it's a IU where user can open a text file through notepad.
The user is then suppose to:
*Change some values in the text file
*save the document though notepad
*get back to the UI.

The problem is that the document can't be saved because "file is open in other program and can't be saved." (translated error massage)

Is there any way of getting around this problem.
I have snipped out the code below.

Dim ProcessProperties As New ProcessStartInfo
Dim myProcess As Process
reader.close()
ProcessProperties.FileName = "notepad.exe"
ProcessProperties.Arguments = lblCurrentFilePath
ProcessProperties.WindowStyle = ProcessWindowStyle.Normal
myProcess = Process.Start(ProcessProperties)
myProcess.WaitForExit()
myProcess.Kill()
OpenFileDialog1_FileOk(bFileEditM, AcceptButton)



Best regards

What I have tried:

not much, only the code above. Don't know any solution.

解决方案

If Notepad can't save the file, it's because either you app has the file open, another app has the file open for shared read but not write, or the user doesn't have permissions to write a file in the folder/location that it is in, such as the root of C: or under Program Files somewhere, or some other location secured by permissions.


这篇关于文件在其他程序中打开,无法保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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