Click here to Skip to main content
15,891,136 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Lists of objects without losing class Intelli-sense Pin
Dave Kreskowiak14-May-13 13:33
mveDave Kreskowiak14-May-13 13:33 
QuestionTryParse String from InputBox to Integer Pin
Member 1004983713-May-13 16:06
Member 1004983713-May-13 16:06 
AnswerRe: TryParse String from InputBox to Integer Pin
PIEBALDconsult13-May-13 17:30
mvePIEBALDconsult13-May-13 17:30 
QuestionHow to get values from listview and display it to textbox using sql database ? Pin
Member 1001708312-May-13 4:58
professionalMember 1001708312-May-13 4:58 
AnswerRe: How to get values from listview and display it to textbox using sql database ? Pin
Eddy Vluggen13-May-13 7:23
professionalEddy Vluggen13-May-13 7:23 
QuestionTreeView Find Starting from Some Child Node Pin
treddie11-May-13 21:20
treddie11-May-13 21:20 
AnswerRe: TreeView Find Starting from Some Child Node Pin
Eddy Vluggen11-May-13 22:18
professionalEddy Vluggen11-May-13 22:18 
GeneralRe: TreeView Find Starting from Some Child Node Pin
treddie11-May-13 23:50
treddie11-May-13 23:50 
Hey, Eddy.

I probably should have put this post in my other thread, since I thought I was asking a separate question, but it turns out, I'm back to the old topic! Smile | :)

The problem I see with that solution is that it assumes that you know that the answer lies somewhere beneath Node2 and not Node1. In fact, if you don't know, then you either have to
'
1). Search the whole tree and find all instances of "Hello", then look at the full path property to see if it matches a pre-defined path, or
'
2). You have to be able to step through each node with Find(), and searchAllChildren = "False", to prevent the search from going any deeper than one node at a time. It also has to reject any instances of the search name that might occur ABOVE the current node. In the latter case, as far as I can tell, you need to be able to set a child node as a current node, as if it was the parent node so that the search starts from there. But vb.Net offers no way to set a child node to "Current" during a Find().

UPDATE:

If I change your code to the following:
VB
Dim MyNodes(2) As TreeNode

MyNodes(1) = TreeView1.Nodes.Add("Node1")
MyNodes(1).Nodes.Add("Sub1", "Sub1").Nodes.Add("Hello", "Hello")

MyNodes(2) = TreeView1.Nodes.Add("Node2")
MyNodes(2).Nodes.Add("Sub1", "Sub1").Nodes.Add("Hello", "Hello")

Dim foundNodes As TreeNode() = MyNodes(2).Nodes.Find("Hello", True)

If foundNodes.Length > 0 Then
  TreeView1.SelectedNode = foundNodes(0)
  TreeView1.Focus()
End If


I gain flexibility in how the parent node is defined, but there is still no flexibility in the Find() operation...If instead of:
= MyNodes(2).Nodes.Find("Hello", True)
'
I want to do:
= MyNodes(2).My1stChildNodes(3).Nodes.Find("Hello", True)

I have to set that up explicitly. And it does not seem to be a problem that lends itself to recursion. The only option then, is to set up separate Find() functions for each node depth you want to start at. For a harddrive's directory structure, that could end up being 10-20 separate functions, easily.

modified 12-May-13 6:13am.

GeneralRe: TreeView Find Starting from Some Child Node Pin
Eddy Vluggen12-May-13 1:16
professionalEddy Vluggen12-May-13 1:16 
GeneralRe: TreeView Find Starting from Some Child Node Pin
treddie13-May-13 11:04
treddie13-May-13 11:04 
GeneralRe: TreeView Find Starting from Some Child Node Pin
TnTinMn13-May-13 15:13
TnTinMn13-May-13 15:13 
GeneralRe: TreeView Find Starting from Some Child Node Pin
treddie13-May-13 18:24
treddie13-May-13 18:24 
GeneralRe: TreeView Find Starting from Some Child Node Pin
Eddy Vluggen14-May-13 9:10
professionalEddy Vluggen14-May-13 9:10 
GeneralRe: TreeView Find Starting from Some Child Node Pin
treddie14-May-13 11:53
treddie14-May-13 11:53 
QuestionStore sha passphrase in code Pin
frankelman11-May-13 2:33
frankelman11-May-13 2:33 
AnswerRe: Store sha passphrase in code Pin
Garth J Lancaster11-May-13 2:54
professionalGarth J Lancaster11-May-13 2:54 
GeneralRe: Store sha passphrase in code Pin
frankelman11-May-13 8:01
frankelman11-May-13 8:01 
GeneralRe: Store sha passphrase in code Pin
Garth J Lancaster11-May-13 17:16
professionalGarth J Lancaster11-May-13 17:16 
GeneralRe: Store sha passphrase in code Pin
frankelman12-May-13 2:22
frankelman12-May-13 2:22 
QuestionConverting a string into a method Pin
treddie10-May-13 20:54
treddie10-May-13 20:54 
AnswerRe: Converting a string into a method Pin
NeverJustHere11-May-13 0:04
NeverJustHere11-May-13 0:04 
GeneralRe: Converting a string into a method Pin
treddie11-May-13 17:05
treddie11-May-13 17:05 
GeneralRe: Converting a string into a method Pin
Dave Kreskowiak11-May-13 19:18
mveDave Kreskowiak11-May-13 19:18 
GeneralRe: Converting a string into a method Pin
treddie11-May-13 21:36
treddie11-May-13 21:36 
GeneralRe: Converting a string into a method Pin
Dave Kreskowiak12-May-13 4:55
mveDave Kreskowiak12-May-13 4: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.