简单加载TreeView1控件代码

 在设计视图拖一个Treeview控件。。。。。。。。。。。。。。

 

TreeNode node = new TreeNode();
            node.Text = "上海";
            node.Value = "上海";
            this.TreeView2.Nodes.Add(node);

            TreeNode node1 = new TreeNode();
            node1.Text = "浦东";
            node1.Value = "浦东";
            node.ChildNodes.Add(node1);
           
            TreeNode DongGouNode = new TreeNode();
            DongGouNode.Text = "东沟";
            DongGouNode.Value = "东沟";
            node1.ChildNodes.Add(DongGouNode);


            TreeNode node2 = new TreeNode();
            node2.Text = "嘉定";
            node2.Value = "嘉定";
            node.ChildNodes.Add(node2);


            TreeNode BeiJingNode = new TreeNode();
            BeiJingNode.Text = "北京";
            BeiJingNode.Value = "beijing";
            this.TreeView2.Nodes.Add(BeiJingNode);

posted @ 2010-01-19 23:30  你妹的sb  阅读(267)  评论(0编辑  收藏  举报
百度一下