Click here to Skip to main content
15,896,118 members
Home / Discussions / Visual Basic
   

Visual Basic

 
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 
Hi again.

I have a peculiar problem that is somewhat reminiscent of vb6's Eval() function.

Let's say I have a TreeView populated with an entire harddrive's directory structure, and I want to select the node that contains a folder I am looking for. If I use the .Find method, the search could take forever, and I may end up with multiple places in the TreeView where this name is located. If I already have the full path to the correct folder, then I need a quick way to get to the node without having to search the entire tree.

Now, I actually have a quick way of doing this (at least I am confident it will work), but in the process of getting to that solution, I was experimenting with another idea that harks back to that vb6 Eval() function...Sort of. That other idea revolved around selectively expanding a tree branch and testing inside each child node to make sure that the next folder name in my full path could be found there. If so, it would expand that node and continue until all folders in the full path had been exhausted. Theoretically, I would then be at my desired node, which I could then select in the tree. But the problem is that in order to do that, you start at TreeView1.Nodes(0) and do a Find(). Once that node is selected, it gets expanded and you then do a Find() for the second folder, which gets found at Nodes(0).Nodes(x). Moving along in the same fashion, you get to Nodes(0).Nodes(x).Nodes(y), and so on till the task is completed. I think you can see the problem already...Without explicitly setting up Case blocks or If/Else blocks to handle each succession of methods,
Nodes(0)<br />
Nodes(0).Nodes(x)<br />
Nodes(0).Nodes(x).Nodes(y),...


there is no way for the code to handle this problem. And such a folder could lie at the tenth childnode, maybe even the twentieth, or more. The point being, it is a kludge to try to estimate when you should stop providing hard-coded cases and pray that some scenario doesn't exceed that limit.

That is when I was thinking if there was a way to build a string programatically to whatever length I needed it to be, like,
"TreeView1.Nodes(0).Nodes(x).Nodes(y).Expand"

and then convert that string into an actual code statement by having the string "evaluated" as such. Is this possible? As I stated above, I think I found another very elegant solution to my TreeView Find() problem which is simple and quick. But I am curious now, if vb.Net has the ability to turn a string into a code statement, or maybe even multiline text into actual vb.Net code?
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 
GeneralRe: Converting a string into a method Pin
treddie13-May-13 11:13
treddie13-May-13 11:13 
GeneralRe: Converting a string into a method Pin
Dave Kreskowiak13-May-13 12:18
mveDave Kreskowiak13-May-13 12:18 
GeneralRe: Converting a string into a method Pin
treddie13-May-13 13:06
treddie13-May-13 13:06 
GeneralRe: Converting a string into a method Pin
Dave Kreskowiak13-May-13 18:26
mveDave Kreskowiak13-May-13 18:26 
GeneralRe: Converting a string into a method Pin
treddie14-May-13 19:34
treddie14-May-13 19:34 
GeneralRe: Converting a string into a method Pin
treddie11-May-13 21:42
treddie11-May-13 21:42 
AnswerRe: Converting a string into a method Pin
dusty_dex11-May-13 0:30
dusty_dex11-May-13 0:30 
GeneralRe: Converting a string into a method Pin
treddie11-May-13 17:07
treddie11-May-13 17:07 
GeneralRe: Converting a string into a method Pin
dusty_dex12-May-13 0:01
dusty_dex12-May-13 0:01 
GeneralRe: Converting a string into a method Pin
treddie12-May-13 0:44
treddie12-May-13 0:44 
GeneralRe: Converting a string into a method Pin
dusty_dex12-May-13 1:05
dusty_dex12-May-13 1:05 
GeneralRe: Converting a string into a method Pin
treddie13-May-13 10:13
treddie13-May-13 10:13 

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.