Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using TreeView.

Posted on 2000-05-01
8
Medium Priority
?
154 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 70

Expert Comment

by:Éric Moreau
ID: 2766251
0
 
LVL 1

Accepted Solution

by:
NancyShah earned 100 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
 

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 143

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

972 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