Click here to Skip to main content
15,741,138 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
This is the code im thinking of but doesn't work

C#
private void Form1_Load(object sender, MouseEventArgs e)
    {
        comboBox1.Items.Add(Properties.Resources);
    }


When the form loads I want it to load the all audio recorces that I put in the my system recources

for example
I put (lol.wav) in my system recources, so then (lol) will appear in the combobox's items
Posted
Updated 7-Apr-12 23:09pm
v2
Comments
mmm3743 8-Apr-12 4:48am    
Put command in the from load event
Try to load 1 item at the time:

1 solution

This is not a simple thing to do: it involves two parts:
1) Get the names of the audio resources
2) Load them into a combobox.

The second is trivial:
C#
myComboBox.Items.Add(myAudioResourceName);


The first is where the fun is!
You get to get a list of all resources in your assembly:

C#
string[] all = System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceNames();

Then, you need to decide if the resource is an audio file or not - it will return a list a of name in the form:
MyProject.MyForm.resources
MyProject.Properties.Resources.resources
MyProject.Resources.mySample.mp3
You will have to pick the audio files out of that!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900