TIP: Click on subject to list as thread! ANSI
echo: visual_basic
to: All
from: John
date: 2003-04-04 15:35:00
subject: Re: Treeview from dirlist

Michael,

Thank you very much.  That worked perfectly.  Have a good day.

"Michael Keating" 
wrote in message
news:...
> Hi, well this may be the dumbest answer too .. but what the hell :-)
> 
> This is one way to do it, chopping up the string around the \ characters;
> 
> Private Sub Command1_Click()
> Dim strPath As String
> Dim strKeyText As String
> Dim strCurrNode As String
> Dim intStrLen As Integer
> 
>     strPath = Dir1.Path
>     ' assuming that a drive is included in the path seems reasonable
>     strCurrNode = Left(strPath, 2)
> 
>     TreeView1.Nodes.Clear
>     TreeView1.Nodes.Add Key:=strCurrNode, Text:=strCurrNode
>     TreeView1.Nodes(strCurrNode).Expanded = True
> 
>     If Len(strPath) > 3 Then
> 
>         strPath = Right(strPath, Len(strPath) - 3)
>     Else
> 
>         strPath = ""
>     End If
> 
>     Do Until Len(strPath) = 0
>         ' chop up the string around the \ character
>         intStrLen = InStr(1, strPath, "\")
> 
>         If intStrLen = 0 Then
> 
>             strKeyText = strPath
>             strPath = ""
>         Else
> 
>             strKeyText = Left(strPath, intStrLen - 1)
>             strPath = Right(strPath, Len(strPath) - (intStrLen))
>         End If
> 
>         TreeView1.Nodes.Add strCurrNode, tvwChild, strKeyText, strKeyText
>         TreeView1.Nodes(strCurrNode).Expanded = True
> 
>         strCurrNode = strKeyText
>     Loop
> 
> End Sub
> 
> 
> "John"  wrote in message
> news:98e57121.0304031402.241162da{at}posting.google.com...
> > Hello,
> >
> > This might be the dumbest question ever asked here, but I have no
> > experience with the Treeview, and after trying all day, I decided to
> > ask the pros.  I simply want to generate a treeview of the path given
> > from "Dir1.path"  I have two small forms.  One contains
the dirlistbox
> > control, the other the treeview control.  I know how to hard code the
> > treeview, but cannot figure out how to generate from
"Dir1.path"  For
> > example:
> >
> > C:\Documents and Settings\Administrator\My Documents
> >
> > is the path output, so in the tree:
> >
> > C:\>
> >     Documents and Settings>
> >                            Administrator>
> >                                          My Documents>
> >
> > is the structure I hope to accomplish.  Any help appreciated.  Thank
> > you.
> >
> > John
---
þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com

---
 * RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS
 * RgateImp.MoonDog.BBS at 4/4/03 3:35:10 PM
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)
SEEN-BY: 633/267 270
@PATH: 278/230 10/345 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.