Results 1 to 3 of 3

Thread: problems with treeview (again) [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    problems with treeview (again) [RESOLVED]

    This code:
    Code:
    'create Artist and Album nodes
                    artist = Mid(str, 1, (dash(0) - 1))
                    album = Mid(str, (dash(0) + 3), (dash(1) - (dash(0) + 2)))
                    track = Mid(str, (dash(2) + 3))
    
                    Try 'if the 'Artist' node has been created already, erase any subsequent ones so there is only one
                        If Node.Text = artist Then
                            Node.Remove()
                        End If
                    Catch 'let's just keep on rolling!
                    End Try
    
                    'parent node:
                    Node = tvw1.Nodes.Add(artist)
                    'child node:
                    Node.Nodes.Add(album)
    It works excellent and creates a parent node with the Artist's name. If there are more than one instance of that name, it ends up with only one.

    However, the child node, which is the album, will only end up with the last album for that artist. It erases the ones prior to it and just shows the last one run across.

    What am I missing here to keep ALL albums as child nodes under the correct artist?

    I'm beginning to think the code for this project isn't very well optimized. I am writing this for my specifically formatted naming scheme only.

    I will put my source code on my ftp server and if anyone is interested, they can look at it and give me some suggestions on how to make it better.

    ftp.andrewrichardson.us
    goto the "upload here" folder and download mp3 sorter.
    you will have to change the source code a tad to use the sample mp3 file I included. Please let me know if you like it or if you have any questions or suggestions..

    Last edited by Andy; Feb 11th, 2004 at 09:53 PM.

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    assuming you call this code then what yoou are doinf is removing the existing artist and then adding an album, so you will always end up with the last album.

    Once you have found the artist, then you should add all albums for that artist before moving onto thenext one.

    I think the problemis more the organsation of the data,which should be able to :

    1. Add the Node for that atist

    2. Add the album for that artist

    3. Add all tracks for that album to the album node

    repeat step 2 until all albums for that artist have been added

    move to next artist

    and that way you don't need the remove of the artist becuase you have dealt with the artist completely.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    that's along the lines of what I was thinking as well. I guess I should hit the white board again and redesign the app.

    thanks for the input!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width