TreeNode tn = new TreeNode();
            string[] ttt = { "ni", "wo", "ta" };
            foreach (string t in ttt)
            {
                 tn.Text = t;
                treeView1.Nodes.Add(tn);
                treeView1.ExpandAll();
            }
 

解决方案 »

  1.   

    string[] ttt = { "ni", "wo", "ta" };
      foreach (string t in ttt)
      {
    TreeNode tn = new TreeNode();  tn.Text = t;
      treeView1.Nodes.Add(tn);
      treeView1.ExpandAll();
      }
      

  2.   

     TreeNode tn;
                string[] ttt = { "ni", "wo", "ta" };
                foreach (string t in ttt)
                {
                    tn = new TreeNode();
                    tn.Text = t;
                    treeView1.Nodes.Add(tn);
                    treeView1.ExpandAll();
                }
      

  3.   

    对不起,刚才着急了,我这提示:不能在多处添加或插入项“wo”。必须首先将其从当前位置移除或将其克隆。
    参数名: node不能在多处添加或插入项“wo”。必须首先将其从当前位置移除或将其克隆。
    参数名: node这是为啥啊
      

  4.   

    TreeNode tn = null;
      string[] ttt = { "ni", "wo", "ta" };
      foreach (string t in ttt)
      {
        tn = new TreeNode();
        tn.Text = t;
        treeView1.Nodes.Add(tn);
      }
    treeView1.ExpandAll();