You can use the 'Level Property of the TreeNode object in the Microsoft TreeView Control to simplify this:
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
TreeNode currentNode = e.Node;
switch (currentNode.Level)
{
case 0:
textBox1.Text = currentNode.Text;
textBox2.Text = currentNode.Nodes[0].Text;
textBox3.Text = currentNode.Nodes[0].Nodes[0].Text;
break;
case 1:
textBox1.Text = currentNode.Parent.Text;
textBox2.Text = currentNode.Text;
textBox3.Text = currentNode.Nodes[0].Text;
break;
case 2:
textBox1.Text = currentNode.Parent.Parent.Text;
textBox2.Text = currentNode.Parent.Text;
textBox3.Text = currentNode.Text;
break;
}
}