?
Solved

view tree structure/tree file format

Posted on 2003-03-16
4
Medium Priority
?
308 Views
Last Modified: 2010-04-07
Hi..
does anyone know how to view and manipulate a tree structure file using VB and what are the best tree file format available ?
0
Comment
Question by:wannajmi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Expert Comment

by:robertlees
ID: 8148576
Without knowing the detail of what you are trying to achieve, this is what I would do...

You say 'tree structure file' - if you really mean file, rather than database, then let's say your file is a text file. I would have each record containing an ID, then its parent ID, then the main text of the item. Each of these would be separated by a delimiter that you wouldn't expect to find otherwise in the text. Say the Tab character. Then I would read through this file, splitting each record into its elements by searching for the Tab characters, then adding to a Tree Control. You can use the ID from each record as the key of the item in the Tree Control. Then the Parent ID from each record would allow it to be attached to its parent item in the Tree Control. Your VB app could allow items to be added, changed and deleted from the tree control. When you have finished, just re-open the file as Output (thereby deleting its previous contents) and dumping the Tree Control contents into the file.

Do you need more detail on how to populate the Tree Control ?
0
 

Author Comment

by:wannajmi
ID: 8148664
My data is about the phylogenetic tree (tree structure from different species) I need to record my data as a tree and open it to manipulate (edit, delete, added) the branches of the tree structure.
0
 

Expert Comment

by:cpcode
ID: 8149495
I would use XML as your way to store hierarchical data. It is easy to use/edit in VB, and very powerful. My company's application is based on a hierarchical data set (a 100,000+ item medical knowledge base), and we use XML for everything we do.

Your file may look like:

<tree>
  <phylus name="yyyy">
    <genus name="xxxx">
      <species name="zzzz" class="aaaa" commonName="abcde"/>  
      <species name="rrrr" class="bbbb" commonName="fghij"/>  
    </genus>
  <phylus>
</tree>

(I'm obviously not an expert), although you pretty much get to decide whatever structure & naming you want.
The advantages of using XML are:

1) Built-in tree libraries: include Microsoft XML in your project references (MSXMLx.DLL), and use the DomDocument object to load your file, and right away you have a hierarchical structure that you can access, modify and query.

2) The file is viewable as a tree in Internet Explorer (or any borwser), and you can show it in your app by using a WebBrowser control (if you have IE, you have this). Just add Microsoft Internet Controls to your components tab to get it.

3) Even though it's easy to implement, this approach has tremendous potential: for example, if you wanted to show your data (or part of it) in a different way, you can use XSLT to format your XML, or to create an HTML.

4) There are mountains of examples and documentation about XML and all you can do with it, as well as VB examples of how to use it in your apps.

Look at the left panel of this web site, with the various categories of questions: that panel is generated on the fly from an XML tree file that contains all the categories, and an XSLT to create the HTML you see.










0
 
LVL 3

Accepted Solution

by:
Shaka913 earned 1200 total points
ID: 8235877
Here is a comment for the purposes of getting the points. Thanks.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question