比如现在有
documents(1级目录)
documents下面有许多子目录,如documents\123,123下面又有许多目录,如documents\123\1234
当然1级目录有好多个~我刚接触vb 我的teamleader给我这个联系呀~~
现在我要treeView中显示跟资源管理器一样的该怎么做,我相信这样的帖子有好多`但找了许久       

解决方案 »

  1.   

    哦~是这样的:字段
    Parent_URL             FRD_NAME
                           Docunents
    Docunents              123
    Document\123           1234
    Document\123\1234      12345
                           Messages
    Messages               111
    Messages\111           1111
    Messages\111\1111      11111
    以上只是列出了简单的样式,各位大侠给点建议呀!!!怎么用treeview去实现?
      

  2.   

    就是一个树吗
    数据库表字段应该是这样的
    id    id
    mc    名称
    pid   父ID
    deep  深度
    ...数据应该是
    1  a    0   1
    2  b    0   1
    3  aa   1   2
    4  bb   2   2
    5  aaa  3   3
    6  bbb  4   3然后在程序中递归就可以了
      

  3.   

    兄弟,公司表是我那样的呀~难道要我修改表么
    Parent_URL                                 FRD_NAME
                                               Docunents
    Docunents                                123
    Document\123                            1234
    Document\123\1234                     12345
                                              Messages
    Messages                                 111
    Messages\111                            1111
    Messages\111\1111                     11111
      

  4.   

    你可以这样:
    rst.open "select Parent_URL,FRD_NAME from Table order by parent_URL,len(parent_url)",cnn
    for i=0 to rst.recordcount-1
        if rst("parent_url")&""="" then
            treeview1.additem ,,rst("Frd_name")&"",rst("Frd_name")&""
        else
            treeview1.additem rst("parent_url")&"",tvwchild,rst("Frd_name")&"",rst("Frd_name")&""    end if 
    rst.movenext
    next
      

  5.   

    你可以这样:
    rst.open "select Parent_URL,FRD_NAME from Table order by parent_URL,len(parent_url)",cnn
    for i=0 to rst.recordcount-1
        if rst("parent_url")&""="" then
            treeview1.Nodes.Add ,,rst("Frd_name")&"",rst("Frd_name")&""
        else
            treeview1.Nodes.Add rst("parent_url")&"",tvwchild,rst("Frd_name")&"",rst("Frd_name")&""    end if 
    rst.movenext
    next
      

  6.   

    rst.open "select Parent_URL,FRD_NAME from Table order by parent_URL,len(parent_url)",cnn
    for i=0 to rst.recordcount-1
        if rst("parent_url")&""="" then
            treeview1.Nodes.Add ,,rst("Frd_name")&"",rst("Frd_name")&""
        else
            treeview1.Nodes.Add rst("parent_url")&"",tvwchild,rst("Frd_name")&"",rst("Frd_name")&""    end if 
    rst.movenext
    next
      

  7.   

    搞笑,为什么一定要用递归?
    你用过VB的treeview吗?