473,661 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

List Box Array and Sounds

20 New Member
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.
Mar 23 '08 #1
1 1520
VBWheaties
145 New Member
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.
Mar 24 '08 #2

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

Similar topics

9
1975
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 = "fishes/5/sound.php"; $sounds = "bears/1/sound.php";
1
3059
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
3206
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 selectable via a selection list. To avoid having to rewrite the list on each page, I moved it into a ..js file that produces it where called. Primary advantage is that when adding new pages, there only one option list to update.
4
4244
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
1859
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 mechanism(s). The text file looks something like this: Name: David Age: 108 Birthday: 061095 SocialSecurity: 476892771999
4
2266
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 value="2">2</option>
3
3570
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 at an index set by the user. the Set statement is this: _people = value; or even _people.Insert(index,value); but these throw 'ArgumentOutOfRange' exception stating: Must be non-negative and less than the size of the collection.
6
1307
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 calculated by a method A_length of the instantiation of the Section's class. Only, two elements in the array (or list ?) have a length that must be calculated according to a totally different procedure, a different function or method. After...
5
9706
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 implement the sparse matrices as a doubly-linked list, in which each non-zero cell is stored roughly as follows: int rownum int colnum
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8855
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7364
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4346
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.