Foxtable(狐表)用户栏目专家坐堂 → [求助]内部函数


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

主题:[求助]内部函数

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/9 22:09:00 [显示全部帖子]

1、递归,这样你就能得到所有的文件路径

 

内部函数 listfile

 

Dim pth As String = args(0)
Dim nms As List(of String) = args(1)
For Each fl As String In filesys.GetFiles(pth)
    nms.add(fl)
Next
For Each dr As String In FileSys.GetDirectories(pth)
    Functions.Execute("listfile",dr,nms)
Next


调用函数:
dim nms As New List(of string)
Functions.Execute("listfile","c:\data",nms)

[此贴子已经被作者于2017/8/9 22:29:27编辑过]

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/9 22:29:00 [显示全部帖子]

改一下

 

Dim pth As String = args(0)
Dim nms As List(of String) = args(1)
For Each fl As String In filesys.GetFiles(pth)
    nms.add(fl)
Next
For Each dr As String In FileSys.GetDirectories(pth)
    Functions.Execute("listfile",dr, nms)
Next


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/9 22:51:00 [显示全部帖子]

你得到nms之后你要怎么处理?你要怎么显示你就引用nms这个集合

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/9 23:15:00 [显示全部帖子]

你要显示到哪里怎么显示?

 

for each s As string in nms

    msgbox(s)

next


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/10 9:07:00 [显示全部帖子]

汗,你到现在连基本代码都不会写。

 

 

For Each s As String In nms
    Forms("窗口1").Controls("TextBox1").Text = String.join(vbcrlf, nms.ToArray)
Next

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/10 9:48:00 [显示全部帖子]

Dim pth As String = args(0)
Dim nms As List(of String) = args(1)
For Each fl As String In filesys.GetFiles(pth)
    nms.add(fl)
Next
For Each dr As String In FileSys.GetDirectories(pth)

    nms.add(dr)
    Functions.Execute("listfile",dr,nms)
Next


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/10 12:01:00 [显示全部帖子]

If nms.count > 0 Then
    Dim path As String = FileSys.GetParentPath(nms(0))
    Dim str As String = ""
    For Each s As String In nms
        str &= s.replace(path, "") & vbcrlf
    Next
    Forms("窗口1").Controls("TextBox1").Text = str
End If

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/10 12:21:00 [显示全部帖子]

If nms.count > 0 Then
    Dim path As String = FileSys.GetParentPath(nms(0)) & "\"
    Dim str As String = ""
    For Each s As String In nms
        str &= s.replace(path, "") & vbcrlf
    Next
    Forms("窗口1").Controls("TextBox1").Text = str
End If

 回到顶部