Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
|
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 20th, 2007, 03:44 PM
Authorized User
 
Join Date: Dec 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to maxl
Default Expanding TreeView from double clicking ListView

I know a lot of people have asked about this and hopefully im not being redundant. I've got an app that displays encrypted files on a USB drive in a treeview/listview combo and im trying to program functionality to double click a folder in listview and have the treevew auto expand and/or highlight the node the corresponds to the folder that was double clicked. The code is activated by a ListViewItemActivate event handler and then its supposed to call the NodeMouseClick event handler for the TreeView when i need it to load the contents of that folder into the ListView and expand the Treeview as far as that particular Node. I've gotten as far as loading the contents of the folder into the listview, thats it. it only does it for one level, meaning if i try and open another folder within the folder i just opened it will just sit. The treeview control doesn't do anything. Any info on this would be great. I know i could use some sord of combination of directoryinfo's with treenodes and things, but i already have this subroutine and i would like to keep the code tidy. Let me know if you would like the code posted.

Any suggestions?

Thanks in advance!

 
Old March 5th, 2007, 12:54 PM
Authorized User
 
Join Date: Oct 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to VBM2
Default

Hi maxl,

One very quick idea...

Both those controls allow you to add "keys" to each individual item /node within the control. So for example:

lstView.Items.Add(mykey, mydisplayvalue, 0)

and then for the treeview:

tvwTree.Nodes.Add(mykey, mydisplayvalue)

Upon the listview item click if there is one?? I can't remember.. you could just then say :

tvwTree.Nodes(mykey).Expand()

Only problem is that you (obviously) need something that's unique... like an ID number to go into these "keys".

Hope this helps!

Cheers,

Craig





Similar Threads
Thread Thread Starter Forum Replies Last Post
CMS: Expanding the database retroviz BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 12 February 27th, 2007 06:15 PM
Compressing and expanding files within an app alantodd Pro VB Databases 1 May 8th, 2006 04:12 PM
Expanding menu blaabil Javascript How-To 0 May 26th, 2005 12:21 PM
aspx - dynamically expanding the page vhrao General .NET 1 November 5th, 2004 03:49 PM
Dynamically expanding and collapsing elements richard.york Javascript 3 November 26th, 2003 09:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.