Foxtable(狐表)用户栏目专家坐堂 → [求助]文本框内容转目录树


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

主题:[求助]文本框内容转目录树

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


加好友 发短信
等级:五尾狐 帖子:1141 积分:11272 威望:0 精华:0 注册:2017/9/26 16:30:00
[求助]文本框内容转目录树  发帖心情 Post By:2018/5/26 18:08:00 [只看该作者]

如图,文本框中的每一行文本,都是由“时间”、“文书”、“接收人”、“诉讼地位”四部分组成的,中间用逗号分隔;然后换行。
怎样将这多行文本转为目录树,比如目录树的节点层级就按照上述四部分的顺序。
谢谢!

图片点击可在新窗口打开查看此主题相关图片如下:image 11.jpg
图片点击可在新窗口打开查看
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:文本转目录树.table





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


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

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:文本转目录树.table


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


加好友 发短信
等级:五尾狐 帖子:1141 积分:11272 威望:0 精华:0 注册:2017/9/26 16:30:00
  发帖心情 Post By:2019/4/22 12:18:00 [只看该作者]

老师好!

获取的4组数据,如果我只想生成3层目录树。根节点命名为是s(0),第2层命名为是s(1),第3层命名为是s(2)&  "(" &  s(3) &  ")" 。

如图所示,应该怎样修改?

谢谢!


图片点击可在新窗口打开查看此主题相关图片如下:360截图20190422120402890.jpg
图片点击可在新窗口打开查看 

 

DataFormat事件:

'''
Dim ary() As String = e.Text.split(";")
Dim trv As WinForm.TreeView = e.Form.controls("Treeview1")
If trv Is Nothing Then Return
trv.nodes.clear
For Each str As String In ary
    Dim s() As String = str.split(",")
    If s.length <> 4 Then Continue For
    Dim n1 As WinForm.TreeNode = Nothing
    Dim n2 As WinForm.TreeNode = Nothing
    Dim n3 As WinForm.TreeNode = Nothing
    Dim n4 As WinForm.TreeNode = Nothing
    For Each nd1 As WinForm.TreeNode In trv.Nodes
        If nd1.name = s(0).trim Then
            n1 = nd1
            For Each nd2 As WinForm.TreeNode In nd1.Nodes
                If nd2.name = s(1).trim Then
                    n2 = nd2
                    For Each nd3 As WinForm.TreeNode In nd2.Nodes
                        If nd3.name = s(2).trim Then
                            n3 = nd3
                            For Each nd4 As WinForm.TreeNode In nd3.Nodes
                                If nd4.name = s(3).trim Then
                                    n4 = nd4
                                End If
                            Next
                           
                        End If
                    Next
                End If
            Next
        End If
    Next
    If n1 Is Nothing Then
        n1 = trv.nodes.Add(s(0).trim)
    End If
    If n2 Is Nothing Then
        n2 = n1.nodes.Add(s(1).trim)
    End If
    If n3 Is Nothing Then
        n3 = n2.nodes.Add(s(2).trim)
    End If
    If n4 Is Nothing Then
        n4 = n3.nodes.Add(s(3).trim)
    End If
Next



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


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

'''
Dim ary() As String = e.Text.split(";")
Dim trv As WinForm.TreeView = e.Form.controls("Treeview1")
If trv Is Nothing Then Return
trv.nodes.clear
For Each str As String In ary
    Dim s() As String = str.split(",")
    If s.length <> 4 Then Continue For
    Dim n1 As WinForm.TreeNode = Nothing
    Dim n2 As WinForm.TreeNode = Nothing
    Dim n3 As WinForm.TreeNode = Nothing
    Dim n4 As WinForm.TreeNode = Nothing
    For Each nd1 As WinForm.TreeNode In trv.Nodes
        If nd1.name = s(0).trim Then
            n1 = nd1
            For Each nd2 As WinForm.TreeNode In nd1.Nodes
                If nd2.name = s(1).trim Then
                    n2 = nd2
                    For Each nd3 As WinForm.TreeNode In nd2.Nodes
                        If nd3.name = s(2).trim Then
                            n3 = nd3                           
                        End If
                    Next
                End If
            Next
        End If
    Next
    If n1 Is Nothing Then
        n1 = trv.nodes.Add(s(0).trim)
    End If
    If n2 Is Nothing Then
        n2 = n1.nodes.Add(s(1).trim)
    End If
    If n3 Is Nothing Then
        n3 = n2.nodes.Add(s(2).trim, s(2).trim & "(" & s(3) & ")")
    End If
Next

 回到顶部