开发者

In WinForms .NET C#, how to save to disk the state of a TreeView control

For a .NET 3.5 VS2008 treeview control, where the item labels are set to be editable, how do I save the changes to disk so that I can load them up again when the application restarts?

T开发者_C百科hanks


Here's an article covering serializing and de-serializing a TreeView control using XmlTextWriter and XmlTextReader.


You have to use a serializer .... binary serializers are the fastest and most efficient but are not widely support by non .Net platforms but they support Serializaition events so you get more granualr control over the serialization process. Use a serializer of your choice to save the state or programmitically do it the long way by using a confile file and save all the expanded nodes and re draw it manually. This is a worthwhile academic excerise but not the best way of doing it.

Serialization is a big chapter, read up on it and choose the class that meets your needs. Remember if your application is goiong to be working with non.Net platforms then XML is the way to go or SOAP !!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜