永久添加树视图节点 [英] permanently adding treeview nodes

查看:59
本文介绍了永久添加树视图节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了将子节点添加到treeview的代码。这是工作。现在的问题是,当我重新运行项目时,添加的子节点不存在意味着它没有存储..如何永久存储它将帮助我?







I wrote the code for adding child node to treeview. it is working. now question is when ever I re-run the project added child node is not there means it was not storing.. how store it permanently will u plz help me?



foreach (Form f in Application.OpenForms)
        {
            if (f.Name == "form1")
            {
                foreach (Control ct in f.Controls)
                {
                    TreeView treeViewToUpdate = ct as TreeView;
                    if (treeViewToUpdate !=null)
                        treeViewToUpdate.Nodes[0].Nodes.Add(Textbox1.text));
                }
            }
 
        }

推荐答案

你应该使用持久存储(用于实例文件或数据库)用于记录您的修改并在每次运行应用程序时应用它们。
You should use persistent storage (for instance a file or a database) for recording your modifications and apply them every time the application is run.


这篇关于永久添加树视图节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆