แก้ไข

แชร์ผ่าน


Audio.PlaySystemSound(SystemSound) Method

Definition

Plays a system sound.

public:
 void PlaySystemSound(System::Media::SystemSound ^ systemSound);
public void PlaySystemSound (System.Media.SystemSound systemSound);
member this.PlaySystemSound : System.Media.SystemSound -> unit
Public Sub PlaySystemSound (systemSound As SystemSound)

Parameters

systemSound
SystemSound

SystemSound object representing the system sound to play.

Exceptions

systemSound is Nothing.

Examples

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.

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:

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