3

I'm writing an AutoCAD Plug-in that shows all the entities as Nodes in a TreeView. I want to be able to get the object from the Node to be able to work with programmatically. This is my code for when a node is clicked:

private void treeView1_MouseClick(object sender, MouseEventArgs e)
    {
        TreeNode node = treeView1.SelectedNode;
        propertyGrid1.SelectedObject = node;
        /*Entity selectedEntity = node.getObject() as Entity; Pseudo-code, need to know how to do this*/
    }
2
  • 1
    There is TreeNode.Tag for storing an arbitrary object ref if that's what your looking for. Commented Apr 21, 2015 at 16:13
  • That worked, put it as an answer for points Commented Apr 21, 2015 at 17:06

1 Answer 1

2

TreeNode has a Tag property that's designed to allow you to associate an object with a Node.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.