此主题相关图片如下:图片2.png
通过这张表,建立下面的目录树
此主题相关图片如下:图片1.png
Dim r As Row = Tables("表A").Current
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
e.Form.Controls("Label1").Text = user.name & "的好友"
trv.BuildTree("表A","角色|姓名")
trv.ExpandAll
Dim Buddies() As String = r("好友").Split(",")
For Each Buddy As String In Buddies
Dim pts() As String = Buddy.Split(".")
If trv.Nodes.Contains(pts(0)) Then
If trv.Nodes(pts(0)).Nodes.Contains(pts(1)) Then
trv.Nodes(pts(0)).Nodes(pts(1)).Checked = True
End If
End If
Next
改这段码,让用户本人不显示在树中
确定后,则自动选择在表A本人用户的好友列添加好友,下面的代码好像完成不了
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim nms As String
For Each nd As WinForm.TreeNode In trv.AllNodes
If nd.Checked AndAlso nd.Level = 1 Then
nms = nms & "," & nd.FullName.Replace("\",".")
End If
Next
If nms > "" Then
Tables("表A").Current("好友") = nms.Trim(",")
End If
e.Form.Close()
[此贴子已经被作者于2021/4/21 12:40:47编辑过]