-
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
-
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
-
Re: listview help
I have changed:
Code:
If n > 0 And n <= lvw.ListItems.Count Then