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.

Exceptions

The following condition can cause an exception:

Remarks

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:

Tasks

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

Example

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.

Requirements

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

Permissions

No permissions are required.

See Also

Tasks

How to: Play System Sounds in Visual Basic

Reference

My.Computer.Audio Object

System.Media.SystemSound

SystemSounds

Audio.PlaySystemSound