|
-
Mar 23rd, 2008, 02:23 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] 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(Index As Integer)
Const sSoundFolder = "C:\Users\Chris\Desktop\Sounds\"
Dim sToneFile As String
Dim x%
If List1(n).ListIndex < 0 Then Exit Sub
sToneFile = sSoundFolder & List1(n).List(List1(n).ListIndex) & ".wav"
x% = sndPlaySound(sToneFile, SND_ASYNC Or SND_NODEFAULT)
End Sub
My items are entered like this:
List1(0).AddItem "Home 1"
List1(0).AddItem "Home 2"
List1(0).AddItem "Home 3"
...
List1(1).AddItem "Office 1"
List1(1).AddItem "Office 2"
...
List1(2).AddItem "School 1"
List1(2).AddItem "School 2"
List1(2).AddItem "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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|