This documentation is archived and is not being maintained.

My.Computer.Audio.PlaySystemSound Method 

Plays a system sound.


' Usage
My.Computer.Audio.PlaySystemSound(systemSound)
' Declaration
Public Sub PlaySystemSound( _
   ByVal systemSound As System.Media.SystemSound _
)

Parameters

systemSound

SystemSound object representing the system sound to play.

The following condition can cause an exception:

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:

The following table lists an example of a task involving the My.Computer.Audio.PlaySystemSound method.

To See

Play a system sound

How to: Play System Sounds in Visual Basic

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.

Namespace: Microsoft.VisualBasic.Devices

Class: Audio

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

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

No permissions are required.

Show: