ComException:找不到文件 [英] ComException: File Not Found

查看:144
本文介绍了ComException:找不到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试打开共享文件夹上的autocad文件,但是由于comexception提示未找到文件,但是文件存在而失败.代码如下:("filePath"是文件的路径,而acApp是对Autocad对象的引用.)

I''m trying to open an autocad file on a shared folder but it fails with comexception saying file was not found, but file exists. Here''s the code: ("filePath" is the path to the file and acApp is a reference to Autocad object.)

if(File.Exists(filePath))
{
    acApp.Documents.Open(filePath);
}



注意:我已拒绝所有用户访问我的共享文件夹,并且只有一个用户可以打开或修改此文件夹及其子文件.在尝试打开dwg文件之前,我已经登录了该用户.



note: i have denied all users access to my shared folder and just one user can open or modify this folder and its sub files.i have logged on this user before trying to open my dwg file.

推荐答案

如果filepath是变量,则应删除其周围的引号:
If filepath is a variable then you should remove the quotes around it:
if(File.Exists(filePath))
{
    acApp.Documents.Open(filePath);
}



如果不是,请尝试将共享文件夹映射到驱动器名称,而不要使用\\computername\sharefolder语法.



If not then try mapping the share folder to a drive name instead of using the \\computername\sharefolder syntax.


这篇关于ComException:找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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