-
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.
-
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!
-
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
-
By Franco22 in forum ASP.NET
Replies: 1
Last Post: 04-08-2003, 04:47 PM
-
By Dave Kekish in forum ASP.NET
Replies: 8
Last Post: 02-24-2003, 09:58 PM
-
By sreedhar in forum ASP.NET
Replies: 0
Last Post: 02-01-2001, 10:15 AM
-
By Glenn in forum ASP.NET
Replies: 0
Last Post: 12-13-2000, 07:55 AM
-
By La Don Reed in forum ASP.NET
Replies: 0
Last Post: 06-20-2000, 02: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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks