473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.
Mar 23 '08 #1
1 1515
VBWheaties
145 100+
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.
I'de use a collection or an array to store the paths relative to the index in the list.
Mar 24 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: mark | last post by:
I have an array as follows $sounds = array(); $sounds = "fishes/1/sound.php"; $sounds = "fishes/2/sound.php"; $sounds = "fishes/3/sound.php"; $sounds = "fishes/4/sound.php"; $sounds =...
1
by: Glen Able | last post by:
Hi, I have a collection of lists, something like this: std::list<Obj*> lists; Now I add an Obj to one of the lists: Obj* gary; lists.push_front(gary);
4
by: Mark Kolber | last post by:
I did a little searching on this but couldn't find an answer... On my website, I have a section of stories (www.midlifeflight.com/stories) There are different stores on different pages that are...
4
by: smshahriar | last post by:
Hi, I want to scan from the following string all the hex numbers and populate an array of integers: 0x27 0x00 0x30 0x00 0x33 0x00 0x36 0x00
10
by: Ernesto | last post by:
I'm still fairly new to python, so I need some guidance here... I have a text file with lots of data. I only need some of the data. I want to put the useful data into an struct-like...
4
by: Ian Richardson | last post by:
Hi, The function I've put together below is a rough idea to extend a SELECT list, starting from: <body> <form name="bambam"> <select id="fred"> <option value="1">1</option> <option...
3
by: Ant | last post by:
Hi, I'm using an array list as the collection for my indexer (_alPeople). When i try to set _alpeople to a value at a certain index, I get an error. I can't simply add the value as it needs to be...
6
by: Osiris | last post by:
Is the following intuitively feasible in Python: I have an array (I come from C) of identical objects, called sections. These sections have some feature, say a length, measured in mm, which is...
5
by: adam.kleinbaum | last post by:
Hi there, I'm a novice C programmer working with a series of large (30,000 x 30,000) sparse matrices on a Linux system using the GCC compiler. To represent and store these matrices, I'd like to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.