hi i have made an window based application using C# .Net and i want to play a specific sound when i click on Button so what should i do?
does it require any dll for that..
please inform me precisely
hi i have made an window based application using C# .Net and i want to play a specific sound when i click on Button so what should i do?
does it require any dll for that..
please inform me precisely
For Windows Forms one way is to use the SoundPlayer
private void Button_Click(object sender, EventArgs e)
{
SoundPlayer simpleSound = new SoundPlayer(@"c:\Windows\Media\chimes.wav");
simpleSound.Play();
}
This will also work with WPF, but you have other options like using MediaPlayer
MSDN page
You could use:
System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"c:\mywavfile.wav");
player.Play();