TreeNode::Index Property
.NET Framework (current version)
Gets the position of the tree node in the tree node collection.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The following code example displays the Text and Index property values of the TreeNode represented by the Parent property of the TreeView::SelectedNode. This example requires that you have a Form with a TreeView control on it. The TreeView should have at least two root nodes, each having at least one child node.
private: void treeView1_AfterSelect( Object^ /*sender*/, TreeViewEventArgs^ e ) { /* Display the Text and Index of the * selected tree node's Parent. */ if ( e->Node->Parent != nullptr && e->Node->Parent->GetType() == TreeNode::typeid ) { statusBar1->Text = String::Format( "Parent: {0}\n Index Position: {1}", e->Node->Parent->Text, e->Node->Parent->Index ); } else { statusBar1->Text = "No parent node."; } }
.NET Framework
Available since 1.1
Available since 1.1
Show: