Results 1 to 7 of 7

Thread: Showing playlist item numbers

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2008
    Posts
    18

    Showing playlist item numbers

    Hello,

    I have been trying to code an mp3 player. It will have some features like winamp.

    I tried to implement showing, removing and padding the playlist item numbers. Under Winamp Preferences, on the playlist window there is a checkbox captioned "Show playlist item numbers in Playlist Editor". When you check it, it will add numbers and removes when unchecked. Also there is another checkbox captioned "Zero pad item numbers".


    Could anyone help me with this?
    Thanks.

  2. #2
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Showing playlist item numbers

    Quote Originally Posted by qwert34
    Hello,

    I have been trying to code an mp3 player. It will have some features like winamp.
    Could anyone help me with this?
    Thanks.
    Since no one has responded to your post, perhaps you should post the code in question. Sometimes members shy away from topics that involve controls that they're not familiar with. However, sometimes the answer to a question may be more of a general coding issue that doesn't require familiarity of a control.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2008
    Posts
    18

    Re: Showing playlist item numbers

    As far as I see, almost every question has been answered on the forum. But I havent got a reply to my questions for weeks. It probably means that it is not answerable.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Showing playlist item numbers

    You haven't had any replies since CDRIVE's because you haven't given us the info he asked for (the code).

    We have absolutely no idea how your program works at the moment, so we can't tell you how to make the changes you want.

    There are many people who are willing to help, but you have to give us enough information to let us do that.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2008
    Posts
    18

    Re: Showing playlist item numbers

    I think my question is clear enough. But I can re-ask it.

    Suppose that, you have a lot of song names in a listbox. When you click the OPTIONS sub-menu, you have a window containing a few options that let you change some settings. There are only two options for the listbox.(2 checkboxes).

    checkbox 1
    caption: Show playlist item numbers in Playlist
    When you tick it, it will add numbers at the beginning of the song names.

    checkbox 2
    caption:Zero pad item numbers in Playlist
    When you tick it(after ticking the first checkbox), it will add some zeroes at the beginning of the numbers, comparing the digits of the numbers.

    I think you all played with Winamp's settings. I want to do the same thing that Winamp does. I dont know how to code it.

    Thanks.

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Showing playlist item numbers

    Never assume that we know how a certain program works, as we don't all use the same programs you do, or the same versions of those programs (in this case your explanation of what you want is good, so it doesn't matter).

    More importantly, don't assume that we have any knowledge at all about your program - in your first post there wasn't even any indication that you were using a ListBox, which at least gives us something to work from.

    To add numbers in front of all items in a ListBox, you can use code like this:
    Code:
    Dim lngLoop as Long
      For lngLoop = 0 to List1.ListCount - 1
        List1.List(lngLoop) = CStr(lngLoop + 1) & " - " & List1.List(lngLoop)
      Next lngLoop
    To zero pad the numbers use the Format function, eg:
    Code:
        List1.List(lngLoop) = Format(lngLoop + 1, "00")  & " - " & List1.List(lngLoop)
    That pads to a fixed two digits, which may not be enough for all the items in your list - to automatically use the right amount of digits you need to detect the length, and build the padding string to that length, eg:
    Code:
        List1.List(lngLoop) = Format(lngLoop + 1, String(Len(List1.ListCount),"0"))  & " - " & List1.List(lngLoop)
    To remove the numbers use the InStr function to find the separator (" - "), and use the result of that to get the Right of the string.

  7. #7
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Showing playlist item numbers

    try this:
    Code:
    Private Sub Check1_Click()
        Dim i As Integer
        Dim number As String
        number = "1256"
        For i = 0 To List2.ListCount - 1
        With List2
         .List(i) = number & .List(i)
        
        End With
        number = number & i
        Next i
    End Sub
    
    Private Sub Check2_Click()
        Dim x As Integer
        Dim i As Integer
        Dim ListItem As String
        For i = 0 To List2.ListCount - 1
        
        With List2
        ListItem = .List(i)
        
        For x = 1 To Len(ListItem) 'we go through the string char by char
           If IsNumeric(Mid(ListItem, x, 1)) Then 'we check if char is numeric
             .List(i) = "0" & .List(i)
           End If
          Next x
        End With
        Next i
    
    End Sub
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

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