Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am working on an application to view my Desktop directory into a TreeView form (which I already done). But my question is, how do I start implementing code to search the entire treeview (including Parents and Childs Nodes) for an item that ENDS WITH ".EXE" only then displays me a message box for the particular item. Thank you.
Posted
Comments
[no name] 6-Jul-14 15:01pm    
http://msdn.microsoft.com/en-us/library/system.windows.forms.treenodecollection.find(v=vs.110).aspx
[no name] 6-Jul-14 15:07pm    
@Wes Aday Thanks for your help, but can you write the code below? Because the code that is on MSDN is too general.
[no name] 6-Jul-14 15:18pm    
No sorry. There is no reason for me to write code for you. How about you give it a try yourself?
[no name] 6-Jul-14 15:46pm    
"I tried" and "no luck" does not tell us anything about your problem. You asked the question and got the answer. We can't see that you have made any effort at all to solve whatever your actual problem is. "Gimme code" is not a question or a description of a problem. Just giving you code leads you to believe that people here will just write code for you for free and you will come to expect people to do your work for you instead of you doing it yourself.
[no name] 6-Jul-14 17:14pm    
Lol

 
Share this answer
 
I wouldn't search at all. Rather if I know beforehand what I want to find (as you do), I would also create a cache of those items.
In this case I might create a Dictionary<string,List<TreeNode>> and whenever I add a TreeNode to the TreeView I would also put it in the appropriate List, then finding "all the EXEs" is as simple as accessing the specified List in the Dictionary.

Do the work once, up front. Think of it like a card catalog at the library.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900