Export (0) Print
Expand All

Audio.PlaySystemSound Method

Plays a system sound.

Namespace:  Microsoft.VisualBasic.Devices
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public void PlaySystemSound(
	SystemSound systemSound
)

Parameters

systemSound
Type: System.Media.SystemSound

SystemSound object representing the system sound to play.

ExceptionCondition
ArgumentNullException

systemSound is Nothing.

The PlaySystemSound method plays the system sound described by systemSound; the sound is played once, in the background.

The value of systemSound must be one of the shared members from the SystemSounds class:

For more information, see Playing Sounds (Visual Basic).

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

This example uses the My.Computer.Audio.PlaySystemSound method to play a system sound.

Sub PlaySystemSound()
    My.Computer.Audio.PlaySystemSound( 
        System.Media.SystemSounds.Asterisk)
End Sub

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft