Dim ftp As New FtpClient
ftp.Host="192.168.1.35"
ftp.Account = "tester"
ftp.Password = "tester"
msgbox(0)------正确弹出
msgbox(vars("zhygwjj"))----弹出显示正确的。
Dim lvw As WinForm.ListView = Forms("FTP管理器").Controls("ListView1")
lvw.Rows.Clear
lvw.Images.Clear
lvw.Images.LargeSize = new size(32,32)
Dim ics As String() = {"swf","accdb","mdb","psd","png","xls","xlsx","bmp","rar","jpg","gif","doc","docx","zip","pdf","txt","ppt","exe","bin","map","other"} '定义扩展名数组
Dim kzms As String ="swf accdb mdb psd png xls xlsx bmp rar jpg gif doc docx zip pdf txt ppt exe bin map" '定义已知扩展名的文本串
For Each ic As String In ics
lvw.Images.AddImage(ic,ic & ".png",ic & ".png") '向listview里添加图标
Next
'==============================以上是设置listview的代码============================
'==============================以下是生成listview的代码============================
msgbox(1)----正确弹出
Dim sts As List(of String) = ftp.GetFileList(vars("zhygwjj"))
msgbox(vars("zhygwjj"))-----弹出报错信息。.NET Framework 版本:2.0.50727.7905
Foxtable 版本:2017.10.26.1
错误所在事件:自定义函数listview
详细错误信息:
调用的目标发生了异常。
未将对象引用设置到对象的实例。
If sts.Count > 0 Then '若有文件
For Each st As String In sts
Dim r As WinForm.ListViewRow = lvw.Rows.Add '增加一行
Dim Dot As Integer = st.LastIndexOf(".") '定义.的位置
Dim kzm As String = st.SubString(Dot + 1) '获取扩展名
r.text = st
If kzms.Contains(kzm) = True Then '若为已知扩展名
r.ImageKey = kzm '指定行的图标键值
Else
r.ImageKey = "other"
End If
Next
End If
msgbox(3)---没有弹出。
ftp.Close
注:系统一直用的好好的,不知道今天怎么就报报错。请分析一下会是什么问题?