-
search in treeview
I have a tree view over a Categories table which has parent ids which I am using to populate a treeview. I populate the root nodes and have code to populate child nodes as required.
However, I need to search on a category ID and expand the tree to show the tree structure for this category. In vb6 would populate a collection and use the treeview key property to populate the tree. As the key property does not exist, need some way to use the tag property in the same manner. I have created a collection as follows:
Private Function getCategoryChain(ByVal CategoryID As Integer) As Collection
Dim intParentID As Integer
Dim intCategoryID As Integer
intCategoryID = CategoryID
getCategoryChain = New Collection
getCategoryChain.Add(intCategoryID)
Do
intParentID = clsCategories.getParentCategory(intCategoryID)
If intParentID = -1 Then
MessageBox.Show(intCategoryID & " doesn't exist", "Category ID", MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Function
End If
intCategoryID = intParentID
If intCategoryID <> 0 Then
getCategoryChain.Add(intCategoryID, , 1)
End If
Loop Until intParentID = 0
End Function
I am at a loss to know how I can create my tree structure from this collection.
Similar Threads
-
By davesd in forum VB Classic
Replies: 7
Last Post: 12-08-2005, 07:46 PM
-
By stevemonty in forum ASP.NET
Replies: 0
Last Post: 08-31-2005, 07:06 AM
-
By Gweely in forum Database
Replies: 2
Last Post: 09-09-2002, 11:42 PM
-
By Larry Serflaten in forum Talk to the Editors
Replies: 3
Last Post: 02-04-2002, 10:54 AM
-
By Larry Serflaten in forum Talk to the Editors
Replies: 3
Last Post: 07-16-2001, 02:30 AM
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