1

I'm very new to Visual Studio 2010. I decided to create a simple WFA with C#. Everything work fine with Images and Audio playback. My intention is to create a standalone application and send it to my friend as a gift. Problem I facing now is that when I tried to publish the application, the Images / Audio is still using the same location in my PC. So it won't play nor display any images.

Any comment on this or guide for me? I did try search for solution but doesn't seems to have any luck. This is the code that I used to play Audio :

SoundPlayer ply = new SoundPlayer(@"C:\Users\Liam619\Documents\Visual Studio 2010\Projects\BirthdayApp\BirthdayApp\Resources\BirthdaySong.wav");

If I remove or change the path, the Application will hit error for locating the Audio file.

  • Look into using properties to store your required data. http://msdn.microsoft.com/en-us/library/a65txexh(v=vs.100).aspx – Peter Ritchie Feb 05 '14 at 18:54

2 Answers2

1

There may be several solutions to your problem.

a) embed the sound into a resource. As a beginner, resources may be a bit tricky to get it right the first time. But I want to encourage you reading something about it. You'll need resources when you want to translate your first program.

b) create an installer which copies the sound file to the installation directory. Try InnoSetup. If you're a programmer, sooner or later, you'll need to create a Setup anyway. Always worth knowing how to do that.

In that case, you still need the path to the sound file, but if you install your EXE into the same path as the sound file, see getting the application's executable directory.

Community
  • 1
  • 1
Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
0

everything in the database whether images or audio refers to your own server database.you have to send the database too with the app and the correct version .NET framework needs to be installed on the target PC.

rushan
  • 211
  • 2
  • 6
  • 16