VFP /禁用消息“文件不存在”

问题描述:

我试图从VFP移除消息 - “文件不存在”,没有运气。VFP /禁用消息“文件不存在”

我想如果文件不存在,它会跳到另一行。

这是我曾尝试:

SET SAFETY OFF 
SET TALK OFF 
SET SYSMENU OFF 
SET NOTIFY OFF 

任何解决方案/建议吗?使用

来源:https://msdn.microsoft.com/en-us/library/33a5zy93(v=vs.71).aspx

您应该简单地检查文件是否存在,而不是击中错误的。即:

local lcFile 
lcFile = "c:\my path\my file.ext" 
if file(m.lcFile) 
    * do whatever with the file 
endif 

你也可以在“出错”或“try-catch”块中包装错误。即:

* With On Error 
on error note 
Use myNonExistentFile 
on error 

* with try-catch 
Try 
    Use myNonExistentFile 
Catch 
Endtry 
+0

谢谢你的回答,这是有帮助的。 – Denis