List Box Array and Sounds

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • michels287
    New Member
    • Mar 2008
    • 20

    List Box Array and Sounds

    Hello... Currently I have an array of 8 listboxes in VB6. Each item in my listbox plays a wav sound from a large file on my desktop called "Sounds".

    I am using the sndPlaySound API.

    The code I have to link everything up is:


    Private Sub List1_Click(Ind ex As Integer)

    Const sSoundFolder = "C:\Users\Chris \Desktop\Sounds \"
    Dim sToneFile As String
    Dim x%

    If List1(n).ListIn dex < 0 Then Exit Sub

    sToneFile = sSoundFolder & List1(n).List(L ist1(n).ListInd ex) & ".wav"
    x% = sndPlaySound(sT oneFile, SND_ASYNC Or SND_NODEFAULT)


    End Sub

    My items are entered like this:

    List1(0).AddIte m "Home 1"
    List1(0).AddIte m "Home 2"
    List1(0).AddIte m "Home 3"
    ...

    List1(1).AddIte m "Office 1"
    List1(1).AddIte m "Office 2"
    ...

    List1(2).AddIte m "School 1"
    List1(2).AddIte m "School 2"
    List1(2).AddIte m "School 3"
    ...


    I now need to go into my desktop "Sounds" file on my desktop and organize things better. I will create folders inside the "Sounds" file called "Home", "Office", "School", and so on. I will move all wav files to their relative folders.

    How can I update my code so that when a new listbox is active in my program the array will go to the different folders?

    To link List1(0) with: "C:\Users\Chris \Desktop\Sounds \Home\"
    To link List1(1) with: "C:\Users\Chris \Desktop\Sounds \Office\"
    To link List1(2) with: "C:\Users\Chris \Desktop\Sounds \School\"
    ... ... ... all the way to List1(7)

    Thanks for your help.
  • VBWheaties
    New Member
    • Feb 2008
    • 145

    #2
    Originally posted by michels287
    Hello... Currently I have an array of 8 listboxes in VB6. Each item in my listbox plays a wav sound from a large file on my desktop called "Sounds".

    I am using the sndPlaySound API.

    The code I have to link everything up is:


    Private Sub List1_Click(Ind ex As Integer)

    Const sSoundFolder = "C:\Users\Chris \Desktop\Sounds \"
    Dim sToneFile As String
    Dim x%

    If List1(n).ListIn dex < 0 Then Exit Sub

    sToneFile = sSoundFolder & List1(n).List(L ist1(n).ListInd ex) & ".wav"
    x% = sndPlaySound(sT oneFile, SND_ASYNC Or SND_NODEFAULT)


    End Sub

    My items are entered like this:

    List1(0).AddIte m "Home 1"
    List1(0).AddIte m "Home 2"
    List1(0).AddIte m "Home 3"
    ...

    List1(1).AddIte m "Office 1"
    List1(1).AddIte m "Office 2"
    ...

    List1(2).AddIte m "School 1"
    List1(2).AddIte m "School 2"
    List1(2).AddIte m "School 3"
    ...


    I now need to go into my desktop "Sounds" file on my desktop and organize things better. I will create folders inside the "Sounds" file called "Home", "Office", "School", and so on. I will move all wav files to their relative folders.

    How can I update my code so that when a new listbox is active in my program the array will go to the different folders?

    To link List1(0) with: "C:\Users\Chris \Desktop\Sounds \Home\"
    To link List1(1) with: "C:\Users\Chris \Desktop\Sounds \Office\"
    To link List1(2) with: "C:\Users\Chris \Desktop\Sounds \School\"
    ... ... ... all the way to List1(7)

    Thanks for your help.
    I'de use a collection or an array to store the paths relative to the index in the list.

    Comment

    Working...