[RESOLVED] Child items in a listview
Hello, I found the project below that is a Listview with child items in the first column (like a treeview).
When you double-click on an item it expands and adds 10 child items. What I'd like to do is add child items without expanding, so the child items are not visible, but still can be used. After playing around with it for an hour I haven't been able to do it.
Is there anybody who wants to take a look at the code and tell me if it's possible to add child items in the first column without expanding and making them visible?
Thank you.
http://img358.imageshack.us/img358/5608/treeviewlz2.png
Re: Child items in a listview
If you don't need the treeview type functionality you may assign the "child" value to some array or array of UDT or collection (would probably be easier) where keye = current listitem.text or listitem.key.
And btw, you may want to use the regular listview.
Re: Child items in a listview
An array is what I used first, but with 300 items and an average of 175 'child' values for each item it gets a bit difficult to work with. Storing everything in text files and continuously opening/reading the text file(s) to get the required values is something I'm trying to avoid.
I was hoping I could add invisible 'child' values and loop through them to get the required value. Maybe I can add 175 Listview columns and make them invisible, but so many columns (even if they're hidden) might cause problems, right?
The project above is using a regular Listview.
Re: Child items in a listview
That would be too many columns. I really don't see any problems with using array - they are fast in VB.
You may also try building your own class and for each new item you would create a new instance and add that new instance to collection. But I think I've mentioned collection already in my earlier post.
Re: Child items in a listview