Yep... You definitely embedded it? By default this is NOT the case, you
need to make sure in Properties on the sound file, "Build Action" is
"Embedded Resource", otherwise you will get a null.
Is it in a folder or just in the 'root' of your project?
Thanks for your interest in my dilemma and your response. Here is how
I added the wav file as a resource.
I opened the project's properties window and selected the resources
tab. I clicked on the dropdown that had the value "Strings" and
selected Audio. I then clicked on Add Resource dropdown and selected
Add Existing File. I had made sure that the wav file I wanted to add
was in the root of the project's project folder. I selected that file
from the add file dialog. The wav file appeared as an icon in the
content part of the window. I can right click on the icon and click
play and the wav file plays fine. The access modifier dropdown is
Internal.
Does this help?
Remember it needs the full name including namespace, so if my sound file was
called 'music.wav' in a folder called 'sounds' and my namespace was
'GoTinker.MyProject'
According to the link I provided, the says that you must specify the
resource in the format:
<AssemblyName>.wavefilename.wav
The angle brackets are required and AssemblyName is case sensitive.
Likw I also said, this used to work. I also made sure the wav file
name was also specfied in the same case as the actual filename I added
which is the same as the resource name label under the icon. In my
case, the assembly name is PlayResourceSoundDemo. I have single
stepped through the code and examined the value of
assembly.GetName().Name and is definitely PlayResourceSoundDemo.
GoTinker.MyProject.Sounds.music.wav
If you really can't find it, do a:
GetManifestResourceNames()
A print each array item to screen, that will show you where it's hiding!
I examined the value returned by this method in the debugger and two
items are listed:
{string[2]}
[0]: "PlayResourceSoundDemo.Properties.Resources.resources"
[1]: "PlayResourceSoundDemo.Form1.resources"