views:

120

answers:

4

I want to add sound effects to my Visual C# program. What's the simplest way to do this?

A: 

You can load a wav file into memory on startup let's say, and then play it on certain events.

tzup
+4  A: 

Use System.Media.SoundPlayer to play a WAV from your .NET application.

GraemeF
wow beat me by 13 seconds, and you named the class long form, *snap*
Simeon Pilgrim
+3  A: 

The SoundPlayer class

Simeon Pilgrim
+3  A: 
System.Media.SoundPlayer sound = new System.Media.SoundPlayer(@"ringout.wav");
sound.PlaySync();
Sunrising
I used sound.Play() instead so that program execution wouldn't pause while the sound is playing.
Phenom