Dim lvw As WinForm.ListView = Forms("附件").Controls("ListView1")
lvw.StopRedraw() '暂停绘制
lvw.View = ViewMode.Details '显示模式为详细内容
lvw.GridLines = True '显示网格线
Dim cls() As String = {"名称","类型","修改日期","大小"} '指定要显示的各列
Dim wds() As Integer = {220,100,75,80} '定义列宽
For i As Integer = 0 To cls.Length - 1
Dim c As WinForm.ListViewColumn = lvw.Columns.Add()'增加列
c.Name = cls(i) '指定列名
c.Text = cls(i)'指定列标题
c.Width = wds(i) '指定列宽
Next
lvw.VirtualMode = True '使用虚拟模式
lvw.ResumeRedraw() '恢复绘制
Dim sts As List(of String) = ftp.GetDetailList(fp)'返回FTP服务器指定目录下的全部文件和子目录,包括文件的名称,修改时间和大小,各项之间用符号*分隔.
If sts.Count > 0 Then '若有文件
For Each st As String In sts
Dim vr As WinForm.ListViewRow = lvw.Rows.Add() '增加一行
vr(st) = sts(st)'这句出错了,把返回的字符串分隔并填入相应的列,请老师补充代码,谢谢!
Next
End If
[此贴子已经被作者于2015/11/13 8:15:42编辑过]