Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Audio.Stop Method

Definition

Namespace:
Microsoft.VisualBasic.Devices
Assembly:
Microsoft.VisualBasic.dll
Assembly:
Microsoft.VisualBasic.Forms.dll
Source:
Audio.vb
Source:
Audio.vb
Source:
Audio.vb
Source:
Audio.vb
Source:
Audio.vb

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Stops a sound playing in the background.

public:
 void Stop();
public void Stop();
member this.Stop : unit -> unit
Public Sub Stop ()

Examples

This example uses the My.Computer.Audio.Stop method to stop the application currently playing background or looping sound and uses the My.Computer.Audio.Play method to play a looping sound in the background.

Sub PlayLoopingBackgroundSoundFile()
 My.Computer.Audio.Play("C:\Waterfall.wav",
 AudioPlayMode.BackgroundLoop)
End Sub
Sub StopBackgroundSound()
 My.Computer.Audio.Stop()
End Sub

This code example can run only within a Windows Forms application.

The file name should reference a .wav sound file on your system.

To simplify the management of your sound files, consider storing the files as application resources. These files can then be accessed through the My.Resources object.

Remarks

The My.Computer.Audio.Stop method stops a sound playing in the background that was started by the My.Computer.Audio.Play method.

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

For more information, see Playing Sounds.

Availability by Project Type

Project type Available
Windows Application Yes
Class Library Yes
Console Application Yes
Windows Control Library Yes
Web Control Library No
Windows Service Yes
Web Site No

Applies to

See also


Feedback

Was this page helpful?