VB.Net - Navigation Tree

  • Thread starter Thread starter ~J~
  • Start date Start date

~J~

~J~

Soldato
Joined
20 Oct 2003
Posts
7,558
Location
London
Been banging my bonce on this one, gonna pass it over to the guru's for a wee bit of help if you don't mind.

Basically, I'm after a navigation tree similar to the following:

PHP:
Group 1
|-----Section 1
				|---Program 1
				|---Program 2
|-----Section 2
				|---Program 1
|-----Section 3
				|---Program 1
				|---Program 2
				|---Program 3
Group 2
|-----Section 1
				|---Program 1
				|---Program 2
|-----Section 2
				|---Program 1
|-----Section 3
				|---Program 1
				|---Program 2
				|---Program 3

Which is grabbed from a XML file.

What I need to be able to do though is firstly:

Grab the "Groups" as a seperate entity altogether and NOT included them in a tree control but the table name within the dataset. So ideally within my dataset I could use a "For Each DataTable in Dataset.Tables" and the TableName would return "Group1", "Group2", etc.

The "Section" entities would be parents in the tree, with the "Programs" been children. I also need to add attributes to the nodes such as "Key", "Allowed", etc, that I can read and act on accordingly.

I have spent a good 2-3 hrs on Google this evening but have turned up with little or no help as it's such a specific problem rather than a generic.

Any help on how to achieve this would be really appreciated.
 
Yeah, something like that, although to be honest as a practical example, here's what I have:

The xml file (it has to be read from an xml) is:


<?
xmlversion="1.0"encoding="utf-8" ?>

<
Group>Sales Order Processing

<Section>Sales Orders

<program>New Order</program>

<
program>Amend Order</program>

<
program>View Order</program>

</
Section>

</
Group>


Pretty straightforward.

And the code at the moment (thanks to you) is now:

Me._dsNavigationBar.ReadXml("..\..\Navigation.xml")

ForEach table As Data.DataTable InMe._dsNavigationBar.Tables

Dim tablename AsString = table.TableName

Dim groupKey AsString = "Group"

Dim sectionKey AsString = "Section"

Dim programKey AsString = "Program"

Dim sectionText AsString = "section here"

Dim programText AsString = "program here"

frmMain.treNavigation.Nodes.Add(groupKey, tablename)

'To change the attributes for this node it would be:

'treeView.Nodes(groupKey). - then whatever

frmMain.treNavigation.Nodes(groupKey).Nodes.Add(sectionKey, sectionText)

'To change the attributes for this node it would be:

'treeView.Nodes(groupKey).Nodes(sectionKey). - then whatever

frmMain.treNavigation.Nodes(groupKey).Nodes(sectionKey).Nodes.Add(programKey, programText)

'To change the attributes for this node it would be:

'treeView.Nodes(groupKey).Nodes(sectionKey).Nodes( programKey). - then whatever

Next


Which when run, shows a navigation tree showing:

PHP:
Section
---section here
			--- program here
			--- program here
---section here
Program

So somewhere I'm doing something (seriously!!) wrong. :confused:
 
Back
Top Bottom