For Each nd As WinForm.TreeNode In trv.AllNodes Select Case nd.Level Case 0 '看下是第几层节点,这边是第一层 If nd.Name <> "全部编码" Then '不等于,拿来的大于和小于呢,又不是数值 If nd.DataRow("上级组") = True Then txt = nd.DataRow("编码") & " " & nd.DataRow("编码名称") nd.Text = txt Output.Show(22)