There doesn't seem to be any problem with that code,
so I would have to guess that the problem is here:
{code}
Dim NewNode As TreeNode =
TV1.Nodes(TV1.SelectedNode.Parent.Index).Nodes.Add("Layer", LayerName, 1, 3)
{code}
That's not a good way to do it. If you're trying to add
a 'sibling' to the selected node, then just use the
SelectedNode's Parent property, and make sure that
the selected node is not a root node, because if it is,
its Parent property will be Nothing.
{code}
Dim parent As TreeNode = TV1.SelectedNode
If Not IsNothing( parent ) Then
parent.Nodes.Add( new TreeNode("Layer", ...))
End If
{code}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011
http://www.acadxtabs.com
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");
wrote in message news:6364715@discussion.autodesk.com...
Tony,
Thank you for the quick reply. I've attached the code for the palette to this
message. If you could take a quick look I would really appreciate it. I only
have one paletteset with one palette. The palette contains UserControl1, and
UserControl1 contains TreeView1 which is where I'm trying to add the Node.
Thanks again.
Jim