SaveLayoutToStream. Error: Could not find part of the path "c: \ TreeListLayout \"
SaveLayoutToStream. Error: Could not find part of the path "c: \ TreeListLayout \"
我试着运行举个例子-link
用户 - 管理员
场景:
- 我展开树列表节点;
- 我执行 "SaveLayoutToStream_mtd ()" 方法;
我排队
System.IO.FileStream outFile = new System.IO.FileStream(fileName, System.IO.FileMode.Create);
一个错误
System.IO.DirectoryNotFoundException: "Could not find part of the
path" c: \ TreeListLayout \ "."
所有代码
string fileName = @"c:\TreeListLayout\";
public void SaveLayoutToStream_mtd()
{
System.IO.FileStream outFile = new System.IO.FileStream(fileName, System.IO.FileMode.Create);
treeList1.SaveLayoutToStream(outFile);
outFile.Close();
}
如何修复错误?
您是否看到您的代码与您引用的示例之间的区别?您正在尝试写入具有无效名称 c:\TreeListLayout\
的文件 - 那是一个目录名称。删除尾部斜杠或附加文件名
我试着运行举个例子-link
用户 - 管理员
场景:
- 我展开树列表节点;
- 我执行 "SaveLayoutToStream_mtd ()" 方法;
我排队
System.IO.FileStream outFile = new System.IO.FileStream(fileName, System.IO.FileMode.Create);
一个错误
System.IO.DirectoryNotFoundException: "Could not find part of the path" c: \ TreeListLayout \ "."
所有代码
string fileName = @"c:\TreeListLayout\";
public void SaveLayoutToStream_mtd()
{
System.IO.FileStream outFile = new System.IO.FileStream(fileName, System.IO.FileMode.Create);
treeList1.SaveLayoutToStream(outFile);
outFile.Close();
}
如何修复错误?
您是否看到您的代码与您引用的示例之间的区别?您正在尝试写入具有无效名称 c:\TreeListLayout\
的文件 - 那是一个目录名称。删除尾部斜杠或附加文件名