Major treeview/list view head ache

Johnson

Well-known member
Joined
Mar 6, 2009
Messages
158
Programming Experience
Beginner
Hello, first i will try to create a picture to you of what i am doing. here is a screen shot to also try help.

I am trying to list all my work folders into a application. The main folder is called Work, That contains subfolders that are years, 2007-2008, 2008-2009 etc

Each of these folders has 2 sub folders call time sheet and invoice(i want to be able to split the listings of these two depedning on radio button selected)

each folder invoice and time sheet has sub folders, the months of the year.

i cant find anything on splitting the resualts

I think the picture explains it well. The only thing i left out was the listview has 2 colums, name and created.

i4myk2.jpg
 
Last edited:
Understanding

Lets see if I am getting your question.

You will have a form with say 3 panels and each panel is made up of a treeview and a listview?

So the first panel is set to show the Work folder which when you select a year and an option button triggers the second panel to open to the directory of that year. The third panel is then filled with the directory selected in the second panel.

So the second and third panels are triggered by the panel above it. This sound right?

Ty
 
Yay, quite proud of myself. just got it to work. well the first bit any way,

Now to my second problem, but here is the code i just wrote to get it to work

VB.NET:
Expand Collapse Copy
    Private Sub cmbYear_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbYear.SelectedIndexChanged
        'Clear treeview
        tvFolders.BeginUpdate()
        Try
            tvFolders.SelectedNode = Nothing ' this is it ;-)
            tvFolders.Nodes.Clear()
        Finally
            tvFolders.EndUpdate()
        End Try

        'Display new list

        Dim tSheet As String = "\Timesheets"
        Dim iVoice As String = "\Invoice"
        Dim sDirs() As String
        Dim Dir
        Dim i As Integer

        If opTS.Checked = True Then
            Dir = cmbYear.Text & tSheet
            sDirs = System.IO.Directory.GetDirectories(Dir)
        Else
            Dir = cmbYear.Text & iVoice
            sDirs = System.IO.Directory.GetDirectories(Dir)
        End If

        'Display results
        For i = 0 To UBound(sDirs)
            tvFolders.Nodes.Add(sDirs(i))
        Next
    End Sub


When the list displays it display the full path. being only a tiny listview and treeview. is there a way to only display either the final folder name or document



any idea?
 
Good.

Good job. As far as just showing the end folder with its file you would simply make that folder as the first node added and the same for the file.

You would have to know what those paths are first obviously. If you were not sure of the exact folder structure you would have to use the file system to search for the folder and then the file.

I have not written too many VB.net windows form apps. I have been writing ASP.net apps and I use to have a control for this type of job in VB6, but it does not port over.

I am currently trying to recreate it in VB.net. I will let you know when it is done if you still need it.

Ty
 
i wa sjust about to reply on here that i solved it myself this morning. 10 points for me again.

I just have 2 issues left.

1: i would like to highlight the newest created doc in the listview.
2:in the treeview it as well displays the full folder path, id like only the last folder displayed.
 
If you want it

I finally was able to finish a project specifically for you issue. I see that you solved your issue, but If you would like mine then I will send it to you.

The project was created in VS 2008.

It contains a class that inherets the treeview and makes events avaliable which you could easily add more to.

The form consists of three split containers, 3 ListView controls, 2 Rectangle shape controls, and 2 checkboxes.

The treeview controls are added dynamically since they are dirived from the class.

Here is a screen shot.

Screenshot%20Directory%20Tree.jpg


Ty
 
I finally was able to finish a project specifically for you issue. I see that you solved your issue, but If you would like mine then I will send it to you.

The project was created in VS 2008.

It contains a class that inherets the treeview and makes events avaliable which you could easily add more to.

The form consists of three split containers, 3 ListView controls, 2 Rectangle shape controls, and 2 checkboxes.

The treeview controls are added dynamically since they are dirived from the class.

Here is a screen shot.

Screenshot%20Directory%20Tree.jpg


Ty


id love for you to be able to send that. Looks like i could learn a lot from it
 
Back
Top