TreeView Control Problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: TreeView Control Problem

  1. #1
    Join Date
    Feb 2005
    Posts
    6

    TreeView Control Problem

    Hi, first i'm sorry about my English, i'm from Portugal.

    Now, i'm having a problem with a class and TreeView, and it's hard to explain.

    Imagine that i have one object named CDColection (that is my CD colection). In that object, i have two other; CDS and CD, that is All my CD's and one CD in my collection. In CD object i have the Title, the Year and the Autor of one CD. Now, the problem:

    i have this code:

    dim Discs as new CDS
    dim Disc as new CD
    dim nNode as node

    for each Disc in Discs
    set nNode = TreeView1.Nodes.Add(,,,Disc.Title)
    Next

    Now imagine that the result is 3 CD's

    the probem is that i have one TreeView completly disconected of my object, and if i click in one node, the result it's always the last CD.

    I can't do : set Disc = TreeView1.SelectedItem, 'cause i have an error, of Course

    If i wan't to click, for exemple, in the second node, how can i get the year and the autor of that CD in the Disc object ?

    Thanks Very Much.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    In your CDCollection, you should include a Key or ID which uniquely identifies each CD. TreeView nodes also include a Key; when you add a CD object to the TreeView, assign the node's Key to be equal to the CD's key. Then when the user clicks on a TreeView node, you can use the Key to look up the CD in the CDCollection.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Feb 2005
    Posts
    6
    Thanks;

    But still have a problem (maybe i don't explain myseelf)

    the result of the key of the TreeView it's a string, and to get the information about my CD i need of a reference to the object.

Similar Threads

  1. IE treeview Control using VB.net
    By Franco22 in forum ASP.NET
    Replies: 1
    Last Post: 04-08-2003, 05:47 PM
  2. Replies: 8
    Last Post: 02-24-2003, 10:58 PM
  3. problem with imageman activex control
    By sreedhar in forum ASP.NET
    Replies: 0
    Last Post: 02-01-2001, 11:15 AM
  4. WEIRD ActiveX control problem
    By Glenn in forum ASP.NET
    Replies: 0
    Last Post: 12-13-2000, 08:55 AM
  5. Explain Microsoft example Treeview Control in ASP
    By La Don Reed in forum ASP.NET
    Replies: 0
    Last Post: 06-20-2000, 03:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center