Treeview ?
Treeview ?
Treeview ?
Treeview ?
Treeview ?
Treeview ? Treeview ? Treeview ? Treeview ? Treeview ? Treeview ? Treeview ? Treeview ?
Treeview ? Treeview ?
Treeview ?
Go Back  Xtreme Visual Basic Talk > > > Treeview ?


Reply
 
Thread Tools Display Modes
  #1  
Old 06-17-2006, 10:03 AM
Chris Ara Chris Ara is offline
Centurion
 
Join Date: Feb 2005
Posts: 176
Question Treeview ?


Is there any way I can save a treeview object into a file, so when I load up the file I can use the saved object to populate a treeview. I have form with a tree view with several nodes and sub nodes and I can't figure out how to save a file where when I load it up it populates the treeview the way it was when you left off.
Reply With Quote
  #2  
Old 06-18-2006, 09:31 AM
MikeJ's Avatar
MikeJTreeview ? MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

There are several ways. You could always take that information and bind it to a dataset, thereby allowing you to save the information in something like an XML file - which you could then load the next time your program starts. You could also create a file structure of your own and parse it. Personally, the XML path is better because it would be done in the "recommended" Microsoft way.
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #3  
Old 06-22-2006, 05:39 PM
Chris Ara Chris Ara is offline
Centurion
 
Join Date: Feb 2005
Posts: 176
Smile

I still do not see any functionality in the treeview object itself to save it's current state. I need something to save all the nodes and there subnodes in a ordered manner.
Reply With Quote
  #4  
Old 06-22-2006, 09:25 PM
MikeJ's Avatar
MikeJTreeview ? MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

This is where you create your own recursive procedure to do it for you. Here's the pseudo-code for what I'd do:
Code:
MyFunction(ByVal Node)
    For Each node in TreeView
        If node Has children
            'Get the next level
            MyFunction(ChildNode)
            WriteToXML(ParentNodeName)
        Else
            'This is the bottom of the tree
            MyFunction(NextNode)
            WriteToXML(ChildNodeName)
        End If
    Next
End Function
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Treeview ?
Treeview ?
Treeview ? Treeview ?
Treeview ?
Treeview ?
Treeview ? Treeview ? Treeview ? Treeview ? Treeview ? Treeview ? Treeview ?
Treeview ?
Treeview ?
 
Treeview ?
Treeview ?
 
-->