I have a Windows application written in C#/.NET.
How can I play a specific sound when a button is clicked?
I have a Windows application written in C#/.NET.
How can I play a specific sound when a button is clicked?
I think you must firstly add a .wav file to Resources. For example you have sound file named Sound.wav. After you added the Sound.wav file to Resources, you can use this code:
System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.Sound);
player.Play();
This is another way to play sound.