Foxtable(狐表)用户栏目专家坐堂 → 用户数超500代码出错,请老师帮忙看看!


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

主题:用户数超500代码出错,请老师帮忙看看!

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


加好友 发短信
等级:小狐 帖子:375 积分:2800 威望:0 精华:0 注册:2015/4/29 11:50:00
用户数超500代码出错,请老师帮忙看看!  发帖心情 Post By:2018/10/13 13:03:00 [只看该作者]

如标题,请帮忙看看该怎么处理,用 的是内置用户管理。
Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView1")
For Each u As UserInfo In Users
    If u.Type = UserTypeEnum.User Then
        If trv2.Nodes.Contains(u.Group) = False Then
            trv2.Nodes.Add(u.Group)
        End If
        trv2.Nodes(u.Group).Nodes.Add(u.Name)
    End If
Next

提示 “未将对象引用设置到对象的实例。”

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106481 积分:541558 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/10/13 14:17:00 [只看该作者]

我测试没有问题,和用户数没有关系。应该是其中有用户的Group是空的。

Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim nn As WinForm.TreeNode = trv2.Nodes.Add("未分组")
For Each u As UserInfo In Users
    If u.Type = UserTypeEnum.User Then
        If u.Group > "" Then
            If trv2.Nodes.Contains(u.Group) = False Then
                trv2.Nodes.Add(u.Group)
            End If
            trv2.Nodes(u.Group).Nodes.Add(u.Name)
        Else
            nn.Nodes.Add(u.Name)
        End If
    End If
Next

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


加好友 发短信
等级:小狐 帖子:375 积分:2800 威望:0 精华:0 注册:2015/4/29 11:50:00
  发帖心情 Post By:2018/10/13 14:32:00 [只看该作者]

以下是引用有点蓝在2018/10/13 14:17:00的发言:
我测试没有问题,和用户数没有关系。应该是其中有用户的Group是空的。

Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim nn As WinForm.TreeNode = trv2.Nodes.Add("未分组")
For Each u As UserInfo In Users
    If u.Type = UserTypeEnum.User Then
        If u.Group > "" Then
            If trv2.Nodes.Contains(u.Group) = False Then
                trv2.Nodes.Add(u.Group)
            End If
            trv2.Nodes(u.Group).Nodes.Add(u.Name)
        Else
            nn.Nodes.Add(u.Name)
        End If
    End If
Next

的确如此 感谢有点蓝老师!


 回到顶部