Dim fjzl As String = "充值凭证附件资料"
Dim ps As System.Diagnostics.Process() = System.Diagnostics.Process.GetProcesses() '终止execl和word进程
If Tables("充值凭证表.充值凭证附件数据表").Current Is Nothing Then
Return
Else
Dim dr As DataRow = Tables("充值凭证表.充值凭证附件数据表").Current.DataRow
If ShowAppWindow(dr("文件名称"),1) = True Then
Try
For Each p As System.Diagnostics.Process In ps
output.show(p.processName)
If ("Excel" = p.ProcessName)
p.kill
End If
If ("WINWORD" = p.ProcessName)
p.kill
End If
Next
Catch ex As Exception
MessageBox.Show("请先关闭已经打开的附件,再关闭窗体!")
End Try
Return
End If
End If
If FileSys.DirectoryExists( ProjectPath & fjzl) = True Then
FileSys.DeleteDirectory(ProjectPath & fjzl,2,2) '则彻底删除之
End If
这段代码运行后,如果附件已经打开,怎么不执行删除文件夹动作呢?