Results 1 to 2 of 2

Thread: [Solved] Listview add subitems, more problems

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    16

    [Solved] Listview add subitems, more problems

    This is now solved, the correct code was
    Code:
    	Private Sub tvFolders1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvFolders1.AfterSelect
    		Dim id3folder As String
    		id3folder = e.Node.FullPath()
    		Dim objMP3Info As New _
    		Monotic.Multimedia.MP3.MP3Info()
    		files = FileIO.FileSystem.GetFiles(id3folder, FileIO.SearchOption.SearchAllSubDirectories, "*.mp3")		
    		For Each a As String In files
    			With lvFiles.Items.Add(FileIO.FileSystem.GetName(a))
    				objMP3Info.Filename = (FileIO.FileSystem.GetParentPath(a) + "\" + FileIO.FileSystem.GetName(a))
    				'MessageBox.Show(objMP3Info.Filename)
    				If (objMP3Info.ID3v1Tag.TagAvailable) Then
    					.SubItems.Add(objMP3Info.ID3v1Tag.Title)
    					.SubItems.Add(objMP3Info.ID3v1Tag.Artist) ' Title
    					.SubItems.Add(objMP3Info.ID3v1Tag.Album) ' Title
    					.SubItems.Add(objMP3Info.ID3v1Tag.Genre) ' Title
    					.SubItems.Add(objMP3Info.ID3v1Tag.Year) ' Title
    					.SubItems.Add(objMP3Info.ID3v1Tag.Title.Length) ' Title
    					' Source  -- Title -- Artist -- Album -- Genre -- Year -- Length
    				End If
    			End With
    		Next
    	End Sub
    I'm now trying a different approuch to my previous problem with the TreeView/ListView issue I had, this new "sollution" seems to be a bit more easy however I still can't solve it.

    The problem is to add the remaining listview.subitems, everything I try ether
    a: crashes app, or
    b: Only adds one subitem.
    If you take a look at the code you should see where my problem is, I where really hoping someone could help me solving it.
    Code:
        Private Sub tvFolders1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvFolders1.AfterSelect
            Dim id3folder As String
            id3folder = e.Node.FullPath()
            Dim objMP3Info As New _
            Monotic.Multimedia.MP3.MP3Info()
            files = FileIO.FileSystem.GetFiles(id3folder, FileIO.SearchOption.SearchAllSubDirectories, "*.mp3")
            '_U = Val(files)
            For Each a As String In files
                With lvFiles
                    objMP3Info.Filename = (FileIO.FileSystem.GetParentPath(a) + "\" + FileIO.FileSystem.GetName(a))                
                    'MessageBox.Show(objMP3Info.Filename)
                    If (objMP3Info.ID3v1Tag.TagAvailable) Then
                        lvFiles.Items.Add(FileIO.FileSystem.GetName(a)).SubItems.Add _
                        (objMP3Info.ID3v1Tag.m_strTitle)
    
                       ' I need to know the next stem for adding next subitem here, 
                       ' I've tried with everything I've come up with so far (Integers etc) but
                       ' to no avail
                        lvFiles.Items(.Columns.(e)).SubItems.Add(objMP3Info.ID3v1Tag.m_strTitle)
                    End If
                    
                    'MessageBox.Show(objMP3Info.ID3v1Tag.Title)
                End With
            Next
    
        End Sub
    Last edited by Tertitten; Mar 8th, 2009 at 06:24 AM. Reason: [Solved]

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