Solved

Using TreeView.

Posted on 2000-05-01
8
149 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
[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
8 Comments
 
LVL 70

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
Industry Leaders: 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!

 
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

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…

734 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