Solved

Using TreeView.

Posted on 2000-05-01
8
144 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 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

18 Experts available now in Live!

Get 1:1 Help Now