If e.Col.name = "图片" Then
Dim dr As DataRow = e.Row.DataRow
If dr.IsNull ("类别") Or Dr.IsNull("楼层") Or Dr.IsNull("产品名") Or Dr.IsNull("单位") Or Dr.IsNull("房间") Then
MessageBox.show("带 * 为必填","提示")
e.cancel = True
Else
baseMainForm.WindowState= Windows.forms.FormWindowState.Minimized
ClipBoard.Clear
Dim proc As new Process
proc.File = ApplicationPath & "/capture.exe"
proc.WaitForClose = True
proc.Start
If ClipBoard.GetImage IsNot Nothing Then
Dim f As String = e.Row("编号") & "\" & e.Row("楼层") &"\" & e.Row("房间")&"\" & e.Row("产品名") & e.Row("产品号") & e.Row("单位") &".png"
Dim path As String = e.Col.DataCol.DefaultFolder
If path = "" Then '''
path =Vars("IPM")
'msgbox(1)
End If
basemainform.WindowState = 2
Dim dir As String = FileSys.GetParentPath(path & "/" & f)
If FileSys.DirectoryExists(dir) = False Then FileSys.CreateDirectory(dir)
ClipBoard.GetImage.save(path & "/" & f)
e.Row(e.Col.name) = f
Dim ftp1 As New FtpClient
ftp1.Host=
ftp1.Account =
ftp1.Password =
Dim path2 As String = ""
Dim file As String = "1.艾迪尔报价库" & "\" & e.Row("编号") & "\" & e.Row("楼层") &"\" & e.Row("房间")
'& e.Row("产品名") & e.Row("产品号") & e.Row("单位") &".png"
For Each s As String In file.split("\")
path2 = path2 & "/" & s
If ftp1.DirExists(path2) = False Then
ftp1.MakeDir(path2)
End If
Next
If ftp1.Upload(path & "/" & f, path2 & "/" & e.Row("产品名") & e.Row("产品号") & e.Row("单位") &".png") = True Then
If ftp1.Upload(path & "\" & f, "/" & f) = True Then
Messagebox.show("上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
Messagebox.show("上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
End If
e.cancel = True
Tables("报价清单").Current.Save() '保存文件的行
End If
End If
End If
这个代码是同时写入本地和FTP 我想改成纯 FTP 写入 不需要本地存储 还有 path =Vars("IPM")
DataTables("报价清单").DataCols("图片").DefaultFolder = Vars("IPM")
DataTables("报价清单").DataCols("图片").SourceFolder = "D:\"
上面的代码只能写入默认地址 我想远程的 地址 账号 密码 路径 也在AfterOpenProject 写入
[此贴子已经被作者于2018/2/3 17:50:44编辑过]