|
-
Mar 21st, 2006, 06:42 AM
#1
Thread Starter
Lively Member
Populate TreeView from text file
Hi,
Just curious is it possible to populate a TreeView from a text file?
-
Mar 21st, 2006, 06:55 AM
#2
Re: Populate TreeView from text file
You populate a TreeView with TreeNodes. Where the information that those nodes contains comes from is completely up to you. Their Text property is just a String, so you can assign whatever string you want.
-
Dec 2nd, 2012, 01:15 PM
#3
Junior Member
Re: Populate TreeView from text file
I made it the simple primitive way ,,, it did work properly
========================================
Private Sub Form_Load()
Dim variable1 As String
Open "tree.txt" For Input As #1
Do While Not EOF(1)
Input #1, variable1
sb = Split(variable1, "|")
Select Case sb(0)
Case "parent"
Me.TreeView1.Nodes.Add , , sb(1), sb(1) 'the parent
Case "child"
Me.TreeView1.Nodes.Add sb(1), tvwChild, sb(2), sb(2) 'the child
End Select
Loop
Close #1
End Sub
=====================
in the text file arrange lines like this
============================
parent|father-name
child|father-name|son-name
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|