看不懂你想表达什么意思。参考代码,全局的click事件
If e.Sender.Name.StartsWith("rbtn") Then
Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim nd As WinForm.TreeNode
Dim tb As DataTable = DataTables("用户")
Dim dt As DataTable = DataTables("部门")
tr.StopRedraw()
tr.Nodes.Clear
Dim dr As DataRow
Select Case e.Sender.Name
Case "rbtn全部"
tr.Nodes.Add("全部")
For Each dr In dt.Select("部门id in (" & tb.GetComboListString("部门ID", "范围 = '全部'").Replace("|", ",") & ")")
nd = tr.Nodes.Add(dr("部门ID"),dr("部门"))
nd.Tag = dr("部门ID")
Functions.Execute("递归",nd,dt)
Next
Case "rbtn本部门"
For Each dr In dt.Select("部门id in (" & tb.GetComboListString("部门ID", "范围 = '本部门'").Replace("|", ",") & ")")
nd = tr.Nodes.Add(dr("部门ID"),dr("部门"))
nd.Tag = dr("部门ID")
Functions.Execute("递归",nd,dt)
Next
Case "rbtn本部门及子部门"
Case "rbtn上级部门"
Case "rbtn上级及本部门和子部门"
Case "rbtn子部门"
End Select
tr.ResumeRedraw
End If