Solved

Using TreeView.

Posted on 2000-05-01
8
145 Views
Last Modified: 2010-05-02
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)
0
Comment
Question by:vnd
8 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 2766251
0
 
LVL 1

Accepted Solution

by:
NancyShah earned 25 total points
ID: 2766317
I used the same code and tried running it .there seems to be no problem.Iam geting the output as expected.
Here is the same code that I used.

Dim schild As Variant

Set xnode = trvAdmin.Nodes.Add(, , , "Administation Options")
schild = Array("Adventures", "Internet", "Games", "Sience", "Programming")

Set xnode = trvAdmin.Nodes.Add(1, tvwChild, , "Book Collection")
For j = LBound(schild) To UBound(schild)
    Set xnode = trvAdmin.Nodes.Add(2, tvwChild, , schild(j))
Next j
Set xnode = trvAdmin.Nodes.Add(1, tvwChild, , "Users")

0
 
LVL 1

Expert Comment

by:NancyShah
ID: 2766320
NancyShah changed the proposed answer to a comment
0
 
LVL 1

Expert Comment

by:NancyShah
ID: 2766329
Vnd,

actually Iam getting the output like this


Administration Options
     + Books Collection
             Adventures              
             Internet
             Games
             Sience
             Progr    
      Users

Is this the one you need..???
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:vnd
ID: 2766567
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
0
 

Author Comment

by:vnd
ID: 2766701
Hmm, for some strange reason the code that i wrote started to work again. I have no idea what was theproblem.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2766854
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...
0
 

Author Comment

by:vnd
ID: 2849000
Comment accepted as answer
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

864 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now