C# TreeView object manipulation through class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tranc3d
    New Member
    • Oct 2008
    • 11

    #1

    C# TreeView object manipulation through class

    Hello,

    I have Form1 which has a TreeView object in it (treeView1). I made a class for manipulating this object which for the moment contains no code :|, because I had trouble "reaching" this treeView1 object in Form1 from my class.
    The class is in a different cs file, in the same namespace as Form1.
    The class will provide easier inserting, deleting and modifying of nodes.

    What is the best method for making a "easier manipulation" class for this object in Form1?

    Is it a CustomTreeView based on the TreeView class a good ideea?

    thank you in advance
  • artov
    New Member
    • Jul 2008
    • 40

    #2
    Make your "another class" subclass of the TreeView class. That way you can reach the tree using "this" variable and also use protected methods and properties of TreeView class.

    Comment

    • tranc3d
      New Member
      • Oct 2008
      • 11

      #3
      I am sending a reference to the treeview1 object to this new class through the constructor. I'll try this for now. I'll keep your ideea in mind, thank you very much.

      Comment

      Working...