|
Now I see...that makes perfect sense. Thanks.
|
|
|
|
|
I like that idea...I'm going to try that route because recursion is just not working for me.
Thanks
|
|
|
|
|
By all means, solve your problem, but recursion is a common concept that you really should learn to wrap your head around. It's not really that complex, you just need to do a little reading so that the penny drops.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
you just need to do a little reading so that the penny drops.
Yup. I think after working my way through this problem I should have an easy time understaing the theory behind it all.
I'm acctually back to the recusion method and it seems to be working out for me...so far.
Thanks for your input.
|
|
|
|
|
I'm a relative newbie to Vb.net...well, programming in general. I'm trying to populate a treeview control with Parent and child nodes that are stored in seperate databases. The databases are linked by an autonumbered ID field.
Can someone steer me in the right direction as far as calling the nodes from the database to populate the treeview when the form is loaded? I would think this is possible but right now I'm a bit clueless...I appreciate any help or direction anyone has to offer.
Sorry if this is vague, if you need more information, please let me know.
|
|
|
|
|
|
Hello,
I am working on a application where I am requesting web pages using
AxWebBrowser1.Navigate2("-URL-")
Also the servers I send request Uses Cookies.
Now In my application I want the cookies to be supported but I dont want to Handle the cookies externally(Through some code). I want it just like the IE does when we browse a web page through IE
Any help will be Greatly thanked.
Actually I am working on my Final Year College Project. And need this thing Desprately.
|
|
|
|
|
Can any body tell me how I would trim ‘TestAirplane’ out of the string below?
C:\Targets\TestAirplane\TestAirplane_WebDoc\TestAirplane_HDS\01 Fuse
The only constants are the slashes “\” and the word “Targets”
I know that I want to find “Targets\” and trim it and everything to the left and then find the next slash”\” and trim it and everything to the right...just can’t figure out how to do it.
Thanks
Brad
|
|
|
|
|
You could use the String.Split command, but thats only if you know for sure that the desired String in the returned array is the 2nd last element.
Dim path as String = "C:\Targets\TestAirplane\TestAirplane_WebDoc\TestAirplane_HDS\01 Fuse"<br />
<br />
Dim s as String()<br />
<br />
s = path.Split(chr(92))<br />
<br />
return s(s.Length-2)
OR
if you place in a FileInfo object you can call the FileInfo.Directory.Parent method which will return the local directory of where the file is located.
Dim f as new FileInfo("C:\Targets\TestAirplane\TestAirplane_WebDoc\TestAirplane_HDS\01 Fuse")<br />
<br />
'should return TestAirplane_HDS<br />
return f.Directory.Parent.ToString
|
|
|
|
|
Anonymous wrote:
s = path.Split(chr(92))
That works good but I don't understand what (chr(92)) is doing. Specifically, what is the 92 for?
Thanks
Brad
|
|
|
|
|
Brad Fackrell wrote:
what is the 92 for?
Thats the ASCII key code for \
For more info at those key codes, you can check ASCII Character Codes[^].
BTW, if you want to be really fancy, you can use the IO.Path.DirectorySeparatorChar instead...
Hope this could help you!
|
|
|
|
|
Absofukinlutely wrote:
Thats the ASCII key code for \
Ahhh...I see. Thank you very much.
|
|
|
|
|
I'd suggest that chr(92) is a complete hack. I certainly wouldn't use it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How would you tackle this one?
|
|
|
|
|
Anonymous wrote:
How would you tackle this one?
How would one tackle what
|
|
|
|
|
With the \ in quotes. \ is used to escape things, so you probably need to do Split('\\') instead of Split('\').
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Oh ok, is that also in VB? I thought that escaping with \ was only in C, C++ and C#.
I never had any problems with it...
|
|
|
|
|
I dunno, but I can't imagine why else someone would use chr(92) or whatever it was.
How do you put a control character in a string in VB then ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Well, i think that is the only flaw in VB
Instead of "Blablabla\nSome more bla", you have to do "Blablabla" & vbNewLine & "Some more bla"
Also, \t = vbTab, \" = "" and \x92 = Chr(92)
A lot more typing...
Cheers!
|
|
|
|
|
Absofukinlutely wrote:
Well, i think that is the only flaw in VB
ROTFL - don't get me started.....
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
That's where the wink is for, right?
See ya!
|
|
|
|
|
i cant remember if \ is a control character in VB but certaintly in VB6 i used to use the chr(92) format quite a lot. For one project i needed to build a VBScript string containing SQL and i found using the character ref was pretty much the only way when creating a string with ' " combinations. Dont think its as much of a problem in VB.Net but i havent really tried.
jon
|
|
|
|
|
Split is probably the easiest way to do this, as has been said, but a regular expression could also be used if you wanted to.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Not sure exactly what you are after; here are several possibilities:
Where s = "C:\Targets\TestAirplane\TestAirplane_WebDoc\TestAirplane_HDS\01 Fuse"
s.Substring(0, s.IndexOf("Targets\") + 8)
Returns "C:\Targets\"
s.Substring(s.IndexOf("Targets\") + 8, s.Length - s.IndexOf("Targets\") - 8)
Returns "TestAirplane\TestAirplane_WebDoc\TestAirplane_HDS\01 Fuse"
s.Substring(s.IndexOf("Targets\") + 8, s.IndexOf("\"c, s.IndexOf("Targets\") + 8) - s.IndexOf("Targets\") - 8)
Returns "TestAirplane"
|
|
|
|
|
Is there a way to get the selectedvalue (or selectedtext or selecteditem) from a databound combobox into a string variable? I keep getting cast from datarowview to type string not valid.
|
|
|
|