Click here to Skip to main content
       

Visual Basic

 
GeneralRe: TreeView Find Starting from Some Child Node PinmvpEddy Vluggen14-May-13 9:10 
GeneralRe: TreeView Find Starting from Some Child Node [modified] Pinmembertreddie14-May-13 11:53 
QuestionStore sha passphrase in code Pinmemberfrankelman11-May-13 2:33 
AnswerRe: Store sha passphrase in code PinmemberGarth J Lancaster11-May-13 2:54 
GeneralRe: Store sha passphrase in code Pinmemberfrankelman11-May-13 8:01 
GeneralRe: Store sha passphrase in code PinmemberGarth J Lancaster11-May-13 17:16 
GeneralRe: Store sha passphrase in code Pinmemberfrankelman12-May-13 2:22 
QuestionConverting a string into a method Pinmembertreddie10-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)
Nodes(0).Nodes(x)
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 PinmemberNeverJustHere11-May-13 0:04 
GeneralRe: Converting a string into a method Pinmembertreddie11-May-13 17:05 
GeneralRe: Converting a string into a method PinmvpDave Kreskowiak11-May-13 19:18 
GeneralRe: Converting a string into a method Pinmembertreddie11-May-13 21:36 
GeneralRe: Converting a string into a method PinmvpDave Kreskowiak12-May-13 4:55 
GeneralRe: Converting a string into a method Pinmembertreddie13-May-13 11:13 
GeneralRe: Converting a string into a method PinmvpDave Kreskowiak13-May-13 12:18 
GeneralRe: Converting a string into a method Pinmembertreddie13-May-13 13:06 
GeneralRe: Converting a string into a method PinmvpDave Kreskowiak13-May-13 18:26 
GeneralRe: Converting a string into a method Pinmembertreddie14-May-13 19:34 
GeneralRe: Converting a string into a method Pinmembertreddie11-May-13 21:42 
AnswerRe: Converting a string into a method Pinmemberdusty_dex11-May-13 0:30 
GeneralRe: Converting a string into a method Pinmembertreddie11-May-13 17:07 
GeneralRe: Converting a string into a method Pinmemberdusty_dex12-May-13 0:01 
GeneralRe: Converting a string into a method Pinmembertreddie12-May-13 0:44 
GeneralRe: Converting a string into a method Pinmemberdusty_dex12-May-13 1:05 
GeneralRe: Converting a string into a method Pinmembertreddie13-May-13 10:13 

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

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


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 16 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid