Results 1 to 3 of 3

Thread: listview help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2005
    Posts
    230

    listview help

    hi all
    i have a listview which contain 2 column

    name of song duration
    1.mp3 00:05:11
    2.mp3 00:04:25
    3.mp3 00:02:41

    Now i want to get the time of the playlist Like:

    3.mp3 will play in 00:02:41 + 00:04:25
    2 will play in 00:04:25+ 00:05:11

    i apreciate your help. thanks

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: listview help

    Here you go:
    Code:
    Option Explicit
    
    Private Sub Command1_Click()
        'to get a certain item...
        Debug.Print getItem(ListView1, 3)
        
        'to get the complete list...
        Debug.Print "***"
            Dim i As Integer
                For i = 1 To ListView1.ListItems.Count
                    Debug.Print getItem(ListView1, i)
                Next i
    End Sub
    
    Private Function getItem(lvw As ListView, n As Integer) As String
        If n > 0 And n <= lvw.ListItems.Count Then
            Dim lvwItem As ListItem
                Set lvwItem = lvw.ListItems.Item(n)
                    getItem = lvwItem.Text & " will play in " & lvwItem.SubItems(1) & " + "
                If n > 1 Then
                    Set lvwItem = lvw.ListItems.Item(n - 1)
                        getItem = getItem & lvwItem.SubItems(1)
                Else
                    getItem = getItem & "00:00:00"
                End If
        Else
            getItem = "Index out of bounds"
        End If
    End Function

  3. #3

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