因为keydownedit要在进入编辑状态的时候生效,我想在选中该表格的时候就生效,能把下面的代码写在 keypressedit事件中吗? 要怎么改下呢? e.control 是不能写在该事件中的
If e.Col.Name = "已接收文件" AndAlso e.Control = True AndAlso e.KeyCode = Keys.V Then
e.Cancel = True '且取消此次按键
'msgbox(1)
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
Index1 = Str_path.LastIndexOf("\") '最后一次出现\符号的位置
Str_file=Str_path.SubString(Index1+1) '从最后一个\符号后开始截取
'上传数据
Dim ftp1 As new ftpclient
ftp1.host="172.16.5.89"
ftp1.Account = "administrator"
ftp1.password = "Admin1234"
ftp1.RootDir="/各表附件/收发文件管理表/已接收文件/"
If Str_file.Contains( e.Table.Name & "_" & "ID" & e.Row("ID") & "_") Then
If ftp1.upload(Str_path,Str_file)=True '上传文件到ftp文件到指定的位置
msgbox("文件上传成功!")
End If
Else
msgbox("文件名不符合命名规范,请重命名后上传!")
Return '结束循环
End If
ls.add(Str_file)
Next
e.Row.DataRow.Lines(e.Col.name) = ls
e.Row.Save
End If