How to: Stop Playing Sounds in the Background in Visual Basic

This example stops a sound playing in the background.

Background playing lets the application execute other code while the sound plays. For more information, see How to: Play Looping Sounds in Visual Basic and How to: Play Sounds in Visual Basic.

In general, when an application plays a looping sound, it should stop the sound at some point.

Use the My.Computer.Audio.Stop method to stop the application's currently playing background or looping sound.

Sub StopBackgroundSound()
End Sub

This code example is also available as an IntelliSense code snippet. In the code snippet picker, it is located in Windows Forms Applications > Sound. For more information, see How to: Insert IntelliSense Code Snippets.

This code example can run only within a Windows Forms or console application. For more information, see Stop.

Community Additions