1 If Form1.txt0.Text <> "" And Form1.txt1.Text <> "" Then '不允许建立零字节的父节点和子节点
 2   CunZai = False
 3   J = TreeView1.Nodes.Count
 4   For I = 1 To TreeView1.Nodes.Count '检查新输入的父节点名称是否存在
 5     If TreeView1.SelectedItem.Children > 0 Then
 6       If txt0.Text = TreeView1.Nodes(I).Text Then CunZai = True
 7        End If
 8   Next I
 9   If CunZai = True Then '若存在, 则在父节点下建立子节点
 10     Set nodx = TreeView1.Nodes.Add(txt0.Text, tvwChild, "child" & J, txt1.Text, 3)
 11     
 12   Else '若不存在,则建立父节点和子节点
 13     Set nodx = TreeView1.Nodes.Add(, , txt0.Text, txt0.Text, 1)
 14     Set nodx = TreeView1.Nodes.Add(txt0.Text, tvwChild, "child" & J, txt1.Text, 3)
 15   End If
 16   Form1.TreeView1.Refresh
 17   ElseIf Form1.txt0.Text = "" Then MsgBox "请输入父节点名称!", vbInformation, "警告!"
 18 ElseIf Form1.txt1.Text = "" Then MsgBox "请输入子节点名称!", vbInformation, "警告!"
 19 End If出现的问题是"只有单击父节点后,才保证添加子节点时不会出错如果不把光标放(单击当前要添加子节点的父节点)在当前要添加子节点的父节点上,就会出错 "实时错误35602    集合中的关键字不唯一"
第13行代码出现错误!