Dim piv As WinForm.PictureViewer = Forms("新增业务单位信息").Controls("PictureViewer1")
Dim ywdwbm As String=Forms("新增业务单位信息").Controls("fkdwbm").value
e.Cancel = True
Dim s As String
With Tables("作业单位")
Dim m As Integer
m = .Find(ywdwbm, .RowSel + 1, "作业单位编码", False, False, True)
If m > - 1 Then '如果找到符合条件的行
.Position = m '则选择该行
End If
End With
Dim r As Row =Tables("作业单位").Current
Dim dlg As new OpenFileDialog
dlg.MultiSelect = True '文件多选
If dlg.ShowDialog = DialogResult.OK Then
For Each fname As String In dlg.FileNames
piv.AddFile(fname)
ftp2.Host="192.168.254.201"
ftp2.Port="****"
ftp2.Account = "*******"
ftp2.Password = "********"
ftp2.RootDir="/workunit/" & ywdwbm
piv.FTPclient=ftp2
If ftp2.Connected = True '如果FTP没有连接
piv.FTPclient.rootdir=ftp2.RootDir
Else
If ftp2.Connect Then
piv.FTPclient.rootdir=ftp2.RootDir
Else
MessageBox.show("网络不通,请稍后再试!","")
End If
End If
End If
If ftp2.DirExists(ftp2.RootDir)=False Then
ftp2.MakeDir(ftp2.RootDir)
End If
If e.DataCol.name = "附件" Then
If e.DataRow.IsNull("作业单位编码") = False
If ftp2.Connected Then
e.path = ProjectPath & "RemoteFiles/workunit/" & ywdwbm & "/"
End If
End If
End If
Dim fp As String ="/workunit/" & ywdwbm & "/" & FileSys.GetName(fname)
If ftp2.Upload(dlg.FileName,fp,True) = True Then '若成功上传
ftp2.close
End If
Next
End If