How to Calculate Depth of the Node in a Tree

Nodes on a tree are part of computer programs that are all linked together. The root of a tree, similar to the root file, has a number of children nodes on it that contain the information needed for the program to run and react to users when they interface with it. Developers can calculate how far on a tree a certain node is located with a command line in the program’s code. Does this Spark an idea?

Instructions

    • 1

      Open the TreeView Control panel then open a command line.

    • 2

      Input: “MessageBox.Show(
      String.Format("Depth of node: {0}",
      treeView1.SelectedNode.Level));”.

      Change “SelectedNode.Level” to the node you want to calculate the depth of.

    • 3

      Hit the “Return” key on your keyboard to get the results.

Related Searches:

References

  • "Seven Languages in Seven Weeks: A Pragmatic Guide to Learning Programming Languages"; Bruce Tate; 2010

Comments

Related Ads

Featured