private void playaudio() // defining the function
{
SoundPlayer audio = new SoundPlayer(Properties.Resources.SoundName); // SoundName is the audio file name
audio.PlayLooping();
}
partial class MyForm
{
private SoundPlayer Player = new SoundPlayer(Properties.Resources.SoundName);
private void PlayAudio()
{
// Если нужно загружать именно по нажатию кнопки
// this.Player = new SoundPlayer(Properties.Resources.SoundName);
this.Player.PlayLooping();
}
}