设计窗口,按钮,比如添加一个上传按钮,代码比如
dim r as row = tables("表A").current
if r is nothing then return
Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "图片文件|*.jpg" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim now As String = Format(Date.now, "yyyyMMddHHmmss")
dim name as string = r("项目名称") & now & ".jpg"
Dim ftp1 As New FtpClient
ftp1.Host="196.128.143.28"
ftp1.Account = "foxuser"
ftp1.Password = "138238110"
If ftp1.Upload(dlg.FileName,name ) = True Then
Messagebox.show("上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
Messagebox.show("上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
End If