Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Treeview and Directory 1

Status
Not open for further replies.

Memento

MIS
Jun 19, 2005
46
0
0
US
VB6

Goal:
Load all the directory file names into a treeview.

End Product:
I'm going to have a Drag and Drop of Reports on Treeview one to Treeview2. I have the code for this part, but not how to get a directory into a treeview.

Here's what I have so far. I can't seem to figure how to "MoveNext" without a recordset. As it is now, the code below will add the item I click-on in FileListBox1 the number of times my ListCount is equal to.


Private Sub cmdTest_Click()
Dim I As Integer
For I = 0 To FileListBox1.ListCount - 1
TreeView1.Nodes.Add , , FileListBox1.Tag, FileListBox1.FileName
Next
End Sub

Private Sub Form_Load()
FileListBox1.Path = "\\Server1\Main\Databases\Crystal Reports\Reports"
End Sub
 
Code:
Private Sub cmdTest_Click()
Dim I As Integer
For I = 0 To FileListBox1.ListCount - 1
    TreeView1.Nodes.Add , , FileListBox1.Tag, FileListBox1.List(I)
Next
End Sub

Bearing in mind that the key assigned to each node must be unique so using FileListBox1.Tag will raise a "Key Is Not Unique In Collection" error.

Trevor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top