Foxtable(狐表)用户栏目专家坐堂 → 文件夹下存在同名文件,出错。


  共有2147人关注过本帖平板打印复制链接

主题:文件夹下存在同名文件,出错。

帅哥哟,离线,有人找我吗?
yancheng
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:842 积分:5971 威望:0 精华:0 注册:2013/6/29 9:36:00
文件夹下存在同名文件,出错。  发帖心情 Post By:2015/9/11 11:55:00 [只看该作者]

材料,表,DataColChanged事件代码如下:
Select Case e.DataCol.Name
    Case "分类"
        If e.DataRow.IsNull("材料文件") = False Then
            Dim str As String = ""
            For Each file As String In e.DataRow.Lines("材料文件")
                str &= "人机材基础\材料文件\" & e.DataRow("分类") & "\" & FileSys.GetName(file) & vbcrlf
            Next
            e.DataRow("材料文件") = str
        End If
            If e.DataRow.IsNull("材料文件")=False Then
        If FileSys.DirectoryExists(ProjectPath & "Attachments\人机材基础\材料文件\" & e.NewValue) Then
            For Each file As String In e.DataRow.Lines("材料文件")
                FileSys.MoveFile(ProjectPath & "Attachments\人机材基础\材料文件\" & e.oldValue & "\" & FileSys.GetName(file),ProjectPath & "Attachments\人机材基础\材料文件\" &  e.newValue & "\" & FileSys.GetName(file))
            Next
        Else
            FileSys.CreateDirectory(ProjectPath & "Attachments\人机材基础\材料文件\" & e.newValue)
            For Each file As String In e.DataRow.Lines("材料文件")
                FileSys.MoveFile(ProjectPath & "Attachments\人机材基础\材料文件\" & e.oldValue & "\" & FileSys.GetName(file),ProjectPath & "Attachments\人机材基础\材料文件\" &  e.newValue & "\" & FileSys.GetName(file))
            Next
        End If
    End If

我在对,材料文件,更改:分类,时,如果这个分类下没有相同的文件,就不会出错。代码正常执行。如果更改后的:分类,名的文件夹下,有相同的,同名文件,就会提示。
调用出错误,死机了。
图片点击可在新窗口打开查看此主题相关图片如下:222.jpg
图片点击可在新窗口打开查看

 回到顶部