using music file in soundPlayer function

S

ss

hi!
i would like to use a file that is located in my project folder.
i don't want to use the full path like c:\project\game\whoss.wav (where
game is the folder for .sln file)
hos can i write a reference to the place where the solution is?
 
S

Steven Nagy

Application.Path
.... contains a reference to the execution folder.
Relative paths normally work as well.
 
S

ss

the probelm is that the execution folder is 'bin' and i can't save
there the music - it's not a good path to load from
any other idea?
 
S

scott blood

Hell,

Well you could create a sub folder inside the folder where your exe is
running from and call the file as follows

string MusicFileName = "test.mp3";
Application.StartupPath + "music\" + MusicFileName;

Hope this helps.

Regards
Scott Blood
C# Developer
 
S

Steven Nagy

I may be confused as to your actual requirements.

Do you want your installed application to reference a path in a
completely different location?
Could you use a FolderBrowserDialog to let the user choose their
project path?
Otherwise do as Scott says; create a sub folder that is relative to
your executable.
Eg. string path = Application.StartupPath + @"..\..\";
This would be 2 directories above where your EXE is running from.

SN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

soundplayer 2
using SoundPlayer with resource? 6
.sln file not valid 5
Opening sln file 1
C# startup project 3
C# objects 4
Changing file/folder names 4
openfiledialog filter ? 6

Top