Include Audio File

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcfly1204
    New Member
    • Jul 2007
    • 233

    #1

    Include Audio File

    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.
  • NitinSawant
    Contributor
    • Oct 2007
    • 271

    #2
    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

    Comment

    • mcfly1204
      New Member
      • Jul 2007
      • 233

      #3
      Yes, I am using VS, which I should have included in my original post. Thanks for the help.

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        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

        Working...