Foxtable(狐表)用户栏目专家坐堂 → 当前块中已声明了局部变量


  共有1648人关注过本帖树形打印复制链接

主题:当前块中已声明了局部变量

帅哥哟,离线,有人找我吗?
ycwk
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1218 积分:8451 威望:0 精华:0 注册:2016/2/2 21:52:00
当前块中已声明了局部变量  发帖心情 Post By:2018/7/12 7:59:00 [只看该作者]

   Dim ftp1 As New FtpClient
   ftp1.Host="172.16.1.1"
   ftp1.Account = "admin"
   ftp1.Password = "Admin"
   ftp1.UTF8=True



  If Tables("自助报障记录表").Current.IsNull("问题描述附件")=False Then    
     If ftp1.DeleteFile("\各表附件\自助报障记录表\" & CurrentTable.Current("问题描述附件")) = True Then
        Messagebox.show("截图删除完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        ftp1.Close
     Else
        Messagebox.show("截图删除失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        ftp1.Close
     End If
  End If



Dim str_serialno As String =  e.Form.Controls("TB_日常问题ID").value & "_" & Format(Date.now, "yyMMddhhmmss") & ".jpg"

bit.save(ProjectPath & "RemoteFiles\" & str_serialno)    '保存图片到本地


运行下面代码报错,要怎么改?

'上传到FTP服务器
Dim ftp1 As new ftpclient
ftp1.host="172.16.1.1" 
ftp1.Account = "admin"
ftp1.password = "Admin"
ftp1.UTF8=True


If ftp1.upload(ProjectPath & "RemoteFiles\" & str_serialno,"\各表附件\自助报障记录表\" & str_serialno)= True Then
    Messagebox.show("截图上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    ftp1.Close
Else
    Messagebox.show("截图上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    ftp1.Close
End If
[此贴子已经被作者于2018/7/12 7:59:55编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/12 9:02:00 [只看该作者]

Dim ftp1 As New FtpClient
ftp1.Host="172.16.1.1"
ftp1.Account = "admin"
ftp1.Password = "Admin"
ftp1.UTF8=True

If Tables("自助报障记录表").Current.IsNull("问题描述附件")=False Then
    If ftp1.DeleteFile("\各表附件\自助报障记录表\" & CurrentTable.Current("问题描述附件")) = True Then
        Messagebox.show("截图删除完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Else
        Messagebox.show("截图删除失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    End If
End If

 

 


Dim str_serialno As String =  e.Form.Controls("TB_日常问题ID").value & "_" & Format(Date.now, "yyMMddhhmmss") & ".jpg"


bit.save(ProjectPath & "RemoteFiles\" & str_serialno)    '保存图片到本地

If ftp1.upload(ProjectPath & "RemoteFiles\" & str_serialno,"\各表附件\自助报障记录表\" & str_serialno)= True Then
    Messagebox.show("截图上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
    Messagebox.show("截图上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
ftp1.Close

 


 回到顶部
帅哥哟,离线,有人找我吗?
ycwk
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1218 积分:8451 威望:0 精华:0 注册:2016/2/2 21:52:00
  发帖心情 Post By:2018/7/12 9:30:00 [只看该作者]

运行到这里报截图上传失败


'msgbox(0)
Dim myGraphics As Graphics = basemainform.CreateGraphics()
Dim s As new Size(2000, 1000) '截取的大小
Dim bit As New Bitmap(s.Width, s.Height, myGraphics)
Dim memoryGraphics As Graphics = Graphics.FromImage(bit)
memoryGraphics.CopyFromScreen(0, 0, 0, 0, s) '截取的开始位置,坐标(100, 200)


     Dim ftp1 As New FtpClient
     ftp1.Host="172.16.1.1"
     ftp1.Account = "admin"
     ftp1.Password = "Admin"
     ftp1.UTF8=True  


  If Tables("自助报障记录表").Current.IsNull("问题描述附件")=False Then  
     
     If ftp1.DeleteFile("\各表附件\自助报障记录表\" & CurrentTable.Current("问题描述附件")) = True Then
        Messagebox.show("截图删除完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
     Else
        Messagebox.show("截图删除失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
     End If
  End If



Dim str_serialno As String =  e.Form.Controls("TB_日常问题ID").value & "_" & Format(Date.now, "yyMMddhhmmss") & ".jpg"


bit.save(ProjectPath & "RemoteFiles\" & str_serialno)    '保存图片到本地


'上传到FTP服务器



If ftp1.upload(ProjectPath & "RemoteFiles\" & str_serialno,"\各表附件\自助报障记录表\" & str_serialno)= True Then
    Messagebox.show("截图上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
    Messagebox.show("截图上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
ftp1.close
[此贴子已经被作者于2018/7/12 9:31:43编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
ycwk
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1218 积分:8451 威望:0 精华:0 注册:2016/2/2 21:52:00
  发帖心情 Post By:2018/7/12 9:34:00 [只看该作者]

下面这样的代码u pload函数是正常的,不知上面的代码为什么运行到u pload就报失败


Dim myGraphics As Graphics = basemainform.CreateGraphics()
Dim s As new Size(2000, 1000) '截取的大小
Dim bit As New Bitmap(s.Width, s.Height, myGraphics)
Dim memoryGraphics As Graphics = Graphics.FromImage(bit)
memoryGraphics.CopyFromScreen(0, 0, 0, 0, s) '截取的开始位置,坐标(100, 200)


     Dim ftp1 As New FtpClient
     ftp1.Host="172.16.1.1"
     ftp1.Account = "admin"
     ftp1.Password = "Admin"
     ftp1.UTF8=True  


  If Tables("自助报障记录表").Current.IsNull("问题描述附件")=False Then  
     
     If ftp1.D eleteFile("\各表附件\自助报障记录表\" & CurrentTable.Current("问题描述附件")) = True Then
        Messagebox.show("截图删除完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
     Else
        Messagebox.show("截图删除失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
     End If
  End If



Dim str_serialno As String =  e.Form.Controls("TB_日常问题ID").value & "_" & Format(Date.now, "yyMMddhhmmss") & ".jpg"


bit.save(ProjectPath & "RemoteFiles\" & str_serialno)    '保存图片到本地


'上传到FTP服务器



If ftp1.upload(ProjectPath & "RemoteFiles\" & str_serialno,"\各表附件\自助报障记录表\" & str_serialno)= True Then
    Messagebox.show("截图上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
    Messagebox.show("截图上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
ftp1.close


'MessageBox.show(1)
Tables("自助报障记录表").Current("问题描述附件")= str_serialno     '在"自助报障记录表"中保存上述图片路径
Tables("自助报障记录表").current.Save    



MessageBox.Show("截图成功!", "提示",MessageBoxButtons.Ok,MessageBoxIcon.Question, 0, Windows.forms.MessageBoxOptions.ServiceNotification)     '模态窗口提示



Dim pbx As WinForm.PictureBox= Forms("软件自助报障系统窗口").Controls("PictureBox1")
pbx.SizeMode = ImageSizeMode.Zoom
pbx.Image = GetImage(ProjectPath & "RemoteFiles\" & str_serialno)



 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/12 9:37:00 [只看该作者]

弹出这个路径

msgbox(ProjectPath & "RemoteFiles\" & str_serialno)

看弹出的路径,对应的文件是否存在。

 

如果文件存在,就是你ftp的信息输入不正确。执行下面代码,看能否连上ftp

 

Dim ftp1 As New FtpClient
ftp1.Host="172.16.5.89"
ftp1.Account = "administrator"
ftp1.Password = "Admin1234"
ftp1.UTF8=True
ftp1.OpenManager


 回到顶部
帅哥哟,离线,有人找我吗?
ycwk
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1218 积分:8451 威望:0 精华:0 注册:2016/2/2 21:52:00
  发帖心情 Post By:2018/7/12 10:06:00 [只看该作者]

把 ftp1.UTF8=true  屏蔽掉就好了,可能是中文文件夹显示为乱码的原因

 回到顶部