Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using TreeView.

Posted on 2000-05-01
8
Medium Priority
?
153 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 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Suggested Courses

670 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