Dim dr = Tables("充值凭证表").Current
Dim czpzID As String = e.Form.Controls("czpzIDTextBox").text
Dim wjmc As String = ""
Dim czrq As String
Dim llkqsh As String
Dim llkzzh As String
Dim fjzl As String
Dim path As String
Dim Result As DialogResult
dr = DataTables("充值凭证表").Find("充值凭证ID='"& czpzID &"'")
If dr Is Nothing Then '如果没找到的话
Return
Else
str =dr("充值凭证ID")
czrq =Format(dr("充值日期"),"yyy年MM月dd日")
llkqsh =dr("起始号")
llkzzh =dr("终止号")
fjzl = format(czrq ,"yyyy年MM月dd日") &"【" & llkqsh & "至" & llkzzh & "】"
path =ProjectPath & "照片" & "\" & "充值凭证截图\" & fjzl
End If
If dr Is Nothing Then '如果没找到的话
MessageBox.Show("数据库中无数据,无效操作!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Return
ElseIf dr.IsNull("充值凭证")=True Then
MessageBox.Show("该充值凭证无照片资料,无效操作!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Return
Else
result= MessageBox.Show("是否将此充值凭证下所有的照片资料复制到桌面 《复制充值凭证截图》文件夹中!", "提示" ,MessageBoxButtons.YesNo,MessageBoxIcon.Question)
If result = DialogResult.yes Then
wjmc = czrq & "【" & llkqsh & "至" & llkzzh & "】"
If FileSys.DirectoryExists(path) Then
For Each file As String In FileSys.GetFiles(path)
Dim name As String = FileSys.GetName(file)
If name.Contains(wjmc) Then
If FileSys.DirectoryExists("C:\Users\Administrator\Desktop\复制充值凭证截图" ) = False Then
FileSys.CreateDirectory("C:\Users\Administrator\Desktop\复制充值凭证截图")
End If
If FileSys.DirectoryExists("C:\Users\Administrator\Desktop\复制充值凭证截图\" & wjmc) = False Then
FileSys.CreateDirectory("C:\Users\Administrator\Desktop\复制充值凭证截图\" & wjmc)
End If
FileSys.CopyFile(file ,"C:\Users\Administrator\Desktop\复制充值凭证截图\" & wjmc & "\" & name , True)
End If
Next
msgbox("该充值凭证所有的照片已成功复制到桌面《复制充值凭证截图》文件夹下级的 《" & wjmc & "》 子文件夹中")
Else
End If
End If
End If
这句代码哪有问题?怎么不复制文件呢?