Link to home
Start Free TrialLog in
Avatar of vnd
vnd

asked on

Using TreeView.

Hi here is what i need to do using TreeView control.
it should look something like this.
Administration Options
     + Books Collection
             Internet              
             Programming
             Science
             Games
      Users
Users is supposed to be pointing to the 1 relation. It does . But the Books Collection String gets changed to the last value of my array. Why ?
Does any one see how it should look like ? So i wrote this code and it works
but for some reason the Books Collection string gets replaced and is assigned
another string instead of  Books Collection. Here is what i have. Please
correct if its possible.
Set xNode = trvAdmin.Nodes.Add(, , , "Administation Options")
sChild = Array("Adventures", "Internet", "Games", "Sience", "Programming")
Dim Ximg As ImageListSet trvAdmin.ImageList = imgX
Set xNode = trvAdmin.Nodes.Add(1, tvwChild, , "Book Collection", 1)
For J = LBound(sChild) To UBound(sChild)
    xNode = trvAdmin.Nodes.Add(2, tvwChild, , sChild(J), 1)Next
Set xNode = trvAdmin.Nodes.Add(1, tvwChild, , "Users", 2)
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

ASKER CERTIFIED SOLUTION
Avatar of NancyShah
NancyShah

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NancyShah
NancyShah

NancyShah changed the proposed answer to a comment
Vnd,

actually Iam getting the output like this


Administration Options
     + Books Collection
             Adventures              
             Internet
             Games
             Sience
             Progr    
      Users

Is this the one you need..???
Avatar of vnd

ASKER

yes thats what i need. This is not the results i get though.
Where it says Books Collection it's being replaced by the last value of the array in my case its Progr. i don't know. Emoreau i try to look at your site
Avatar of vnd

ASKER

Hmm, for some strange reason the code that i wrote started to work again. I have no idea what was theproblem.
Could it be that you were debugging and stepping around in your code?
Anyway, i suggest you supply Key values to your nodes, and use these instead of the index values (1 and 2) to add child nodes. You will find this very helpful later to identify which node is actually selected...
Avatar of vnd

ASKER

Comment accepted as answer