Click here to Skip to main content
15,905,686 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionRuntime instance creation Pin
SelvaShankar16-Oct-08 19:59
SelvaShankar16-Oct-08 19:59 
AnswerRe: Runtime instance creation Pin
Steven J Jowett16-Oct-08 22:44
Steven J Jowett16-Oct-08 22:44 
AnswerRe: Runtime instance creation Pin
Mycroft Holmes17-Oct-08 23:24
professionalMycroft Holmes17-Oct-08 23:24 
GeneralRe: Runtime instance creation Pin
SelvaShankar20-Oct-08 19:06
SelvaShankar20-Oct-08 19:06 
AnswerRe: Runtime instance creation Pin
SelvaShankar31-Oct-08 2:06
SelvaShankar31-Oct-08 2:06 
QuestionPopulate TreeView on demand in VB Pin
Sonhospa16-Oct-08 9:46
Sonhospa16-Oct-08 9:46 
AnswerRe: Populate TreeView on demand in VB Pin
Dave Kreskowiak16-Oct-08 10:05
mveDave Kreskowiak16-Oct-08 10:05 
NewsRe: Populate TreeView on demand in VB Pin
Sonhospa16-Oct-08 11:24
Sonhospa16-Oct-08 11:24 
Thanks for the idea, Dave. Let me try to make it clearer:

- On the first level I only show the drives (e.g. "C:\") in the tree view, populated with nodes for existing subdirectories (e.g. "C:\Test", "C:\Real" etc.) in the "form_Load" event. This way, the nodes only have a "plus" once there are subdirectories existing! A drive without subdirectories (e.g. empty removable) doesn't have a "plus".

- Once the user selects and expands a node (e.g. "+ C:\"), I use the the "TreeView_BeforeExpand" event to populate the child nodes with the next level of subdirectories (grand children --> e.g. "C:\Test\TestDir1", "C:\Test\TestDir2" etc.). Again: If "C:\Real" doesn't have any subdirectories, it's not populated with "grandchild" nodes and therefore doesn't have a "plus" when the "C:\" node expands, while the other node ("+ C:\Test") has a "plus".

Other words: The event or the parent node populates all the child nodes with probable grandchild nodes before the child nodes are shown (without "plus" if they don't have subdirectories).

- For performance reasons I ONLY populate the children of the node that the user wants to expand. Not knowing it any better, I use the "SelectedNode" property in my code to find out which node to populate.

Up to here it works fine - and I think even better than with dummies, because adding dummies I have the "plus" even for folders without subfolders... don't I?

But here's my real problem:In case the user wants to expand the node by clicking on the "plus" ---> without explicitly selecting (or double-clicking) the drive letter (!) --- then my whole code doesn't populate the subfolders because my "for ... next" loop says "..each ChildNode ... in Treeview.SelectedNode".

Obviously clicking the "plus" doesn't select the relevant node! Which event is raised when the user clicks "plus" in the TreeView control?

It's a bit hard for me to explain... hope you know what I mean... otherwise I'd try again Shucks | :-\

modified on Thursday, October 16, 2008 5:46 PM

GeneralRe: Populate TreeView on demand in VB Pin
Dave Kreskowiak16-Oct-08 12:07
mveDave Kreskowiak16-Oct-08 12:07 
QuestionRe: Populate TreeView on demand in VB Pin
Sonhospa16-Oct-08 12:35
Sonhospa16-Oct-08 12:35 
AnswerRe: Populate TreeView on demand in VB Pin
Dave Kreskowiak16-Oct-08 13:50
mveDave Kreskowiak16-Oct-08 13:50 
GeneralRe: Populate TreeView on demand in VB Pin
Sonhospa16-Oct-08 20:22
Sonhospa16-Oct-08 20:22 
GeneralRe: Populate TreeView on demand in VB Pin
Dave Kreskowiak17-Oct-08 1:54
mveDave Kreskowiak17-Oct-08 1:54 
QuestionProblems Calling A Function Pin
Phantom71516-Oct-08 7:47
Phantom71516-Oct-08 7:47 
AnswerRe: Problems Calling A Function Pin
nlarson1116-Oct-08 7:56
nlarson1116-Oct-08 7:56 
GeneralRe: Problems Calling A Function Pin
Phantom71516-Oct-08 8:01
Phantom71516-Oct-08 8:01 
GeneralRe: Problems Calling A Function Pin
nlarson1116-Oct-08 8:05
nlarson1116-Oct-08 8:05 
AnswerRe: Problems Calling A Function Pin
Caio Kinzel Filho16-Oct-08 8:28
Caio Kinzel Filho16-Oct-08 8:28 
GeneralRe: Problems Calling A Function Pin
Phantom71516-Oct-08 8:44
Phantom71516-Oct-08 8:44 
GeneralRe: Problems Calling A Function Pin
Caio Kinzel Filho16-Oct-08 9:01
Caio Kinzel Filho16-Oct-08 9:01 
GeneralRe: Problems Calling A Function Pin
Phantom71516-Oct-08 9:04
Phantom71516-Oct-08 9:04 
GeneralRe: Problems Calling A Function Pin
Caio Kinzel Filho16-Oct-08 9:15
Caio Kinzel Filho16-Oct-08 9:15 
GeneralRe: Problems Calling A Function Pin
Caio Kinzel Filho16-Oct-08 9:17
Caio Kinzel Filho16-Oct-08 9:17 
GeneralRe: Problems Calling A Function Pin
Phantom71516-Oct-08 9:37
Phantom71516-Oct-08 9:37 
GeneralRe: Problems Calling A Function Pin
Caio Kinzel Filho17-Oct-08 6:55
Caio Kinzel Filho17-Oct-08 6:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.