9 Kasım 2016 Çarşamba

c# play sound

private void playSoundFromResource(object sender, EventArgs e) 
{ 
    System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly(); 
    System.IO.Stream s = a.GetManifestResourceStream("<AssemblyName>.chimes.wav"); 
    SoundPlayer player = new SoundPlayer(s); 
    player.Play(); 
}


method 2:

SoundPlayer sPlayer = new SoundPlayer(chrome32.Properties.Resources.a);
            sPlayer.Play();

chrome32 is assemblyname