VFP /禁用消息"文件不存在"

时间:2017-09-15 10:39:41

标签: database notifications alert visual-foxpro

我试图从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

1 个答案:

答案 0 :(得分:3)

您应该只检查文件是否存在而不是出现错误。即:

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

您也可以将错误包装在"错误"或"尝试捕获"块。即:

* With On Error
on error note
Use myNonExistentFile
on error

* with try-catch
Try
    Use myNonExistentFile
Catch
Endtry