Quick C# Question

i know this is not place for C# but still .. i think its quick question .. so if you know, reply please ...

im trying to add sound to my program but i have a question..

it works with this code:
1
2
System.Media.SoundPlayer audioplayer = new System.Media.SoundPlayer(@"C:\Users\Srgjan\Desktop\DEV\C#\Test\Sounds\starting.wav");
audioplayer.Play(); 


so what i want to do is .. choose sound from Sounds\starting.wav .. without C:\ (full directory) ..

how to do it?

i was trying (@"Sounds\starting.wav"); since sounds in already in the project .. but it wont let me..
Hi!

Not sure if this might work, but have you tried using: "../Sounds\starting.wav"
Last edited on
i tried it now but doesnt work :|
Where is the .exe located? Where do you run the program? Debug? Release? Tell me the exact folder using the C:/ as well.
 
C:\Users\Srgjan\Desktop\DEV\C#\Test\Test\bin\Debug\Test.exe 
Copy the program and paste it in a new folder, make a folder called "Sounds" inside the folder you have just created, so you have:

First adjust the code by putting:
Sounds\starting.wav"), build it, and place the program:

New Folder/program.exe
New Folder/Sounds/starting.wav

i just copied Sounds folder in Debug and its done .. thanks man
Topic archived. No new replies allowed.