![]() |
|
[C#] TreeView Node Tag - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] TreeView Node Tag (/showthread.php?tid=5869199) |
TreeView Node Tag - twistedweb - Aug 2, 2018 For the life of me, I can not figure out how to use the Tag property with Treeview as I did with listview. Then again, there is a possibility I'm just burnt out at this point. To help explain my question, here is how I am currently using the Tag property for listview items. After retrieval from database I call a method to fill each row, then set tag per item as seen below... Code private async Task FillRow(MyClass myClass)In the instance of a listview row being double clicked, I can then launch the editor as such... Code private void OpenEditor()Here is how I am currently utilizing the Treeview which has worked fine for 'navigation' up until this point, but now that I'm getting further along, the need to manipulate the potential 'navigation' items have become a necessity. Code private void FillTree()I guess ultimately my question is, am I able to implement Tag somewhere in here to store these values for an editor down the road? Or am I using the treeview in a terrible manner? RE: TreeView Node Tag - HFDone - Aug 2, 2018 TreeNodeCollection newParentNode = parentNode.Add(key, text).Nodes; // HERE YOU CAN LOOP THE NODES AND SET THE TAG PopulateTreeView(newParentNode, Convert.ToInt32(dr["ID"]), dt); |