剪切的代码是下面这样写的,但是总感觉不好。 表格里的内容除了用 CurrentTable.Current("已接收文件") 表示外,还可以用 r.datarow.lines(cname) 这种方式写吗?
e.Table.cols(e.Table.colsel).name 表示什么意思呢? e.Table.rows(e.Table.rowsel) 呢? 哪里有相关说明?
' 按下ctrl+X
'Dim cname As String = e.Table.cols(e.Table.colsel).name
'Dim r As Row = e.Table.rows(e.Table.rowsel)
If cname = "已接收文件" AndAlso e.Control = True AndAlso e.KeyCode = Keys.X Then
'msgbox(1)
e.Cancel = True '且取消此次按键
e.Table.FinishEditing
'Dim ls = e.Row.DataRow.Lines(e.Col.name)
' For Each Str_path As String ' In Clipboard.GetFileDropList
'msgbox(str_path)
' Dim Index1 As Integer
' Dim Str_file As String
'下载数据
Dim ftp1 As new ftpclient
ftp1.host="172.16.5.89"
ftp1.Account = "administrator"
ftp1.password = "Admin1234"
ftp1.RootDir="/各表附件/收发文件管理表/已接收文件/"
'Dim str As String= r.DataRow.Lines(cname)
Dim str_path=ProjectPath & "RemoteFiles\" & CurrentTable.Current("已接收文件")
' msgbox(str_path)
If FileSys.FileExists(str_path) Then '如果本地文件已经存在
FileSys.DeleteFile(str_path) '则删除之以便重新下载
End If
If ftp1.Download(CurrentTable.Current("已接收文件"),str_path) = True Then
ftp1.DeleteFile(CurrentTable.Current("已接收文件"))
'以下三行为将文件路径复制到剪贴板中
Dim ls As new System.Collections.Specialized.StringCollection
ls.add(str_path)
My.Computer.Clipboard.SetFileDropList(ls)
CurrentTable.Current("已接收文件")=Nothing
msgbox("复制成功")
'Messagebox.show("复制成功!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
r.Save
End If