I have a simple project that plays a .wav file. I want to include the .wav file in the project so that when I compile, the .wav file is always available. I have added a reference to the .wav file, but I am not certain where to go from there.
Include Audio File
Collapse
X
-
Are you using visual studio??
If yest then, add file to the project, select the file in solution explorer, click on properties, and select "Copy to output directory",
and you're done -
The problem with including it the output directory as described is that it can still be deleted by the end user in the future. Then what do you do?
You want to make it a resource of your project and play it from there. This way it is never a file seen on the HDD for the user to kill.
code tends to look like this (used for obtaining a graphic)
Code:this.pictureBox1.Image = global::MyCoolApplication.Properties.Resources.gadget_expand;
Comment
Comment