Files
docs-desktop/dotnet-desktop-guide/framework/winforms/controls/how-to-play-a-system-sound-from-a-windows-form.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

1.3 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Play a System Sound from a Windows Form 03/30/2017
csharp
vb
sounds [Windows Forms], playing for system events
playing sounds [Windows Forms], Windows Forms
system sounds [Windows Forms], playing from Windows Forms
playing sounds [Windows Forms], system
SoundPlayer class [Windows Forms], system sounds
sounds [Windows Forms], playing
examples [Windows Forms], sounds
afb206ff-4824-4804-a8d4-185bf5ad8e7c

How to: Play a System Sound from a Windows Form

The following code example plays the Exclamation system sound at run time. For more information about system sounds, see xref:System.Media.SystemSounds.

Example

Public Sub PlayExclamation()  
    SystemSounds.Exclamation.Play()  
End Sub  
public void playExclamation()  
{  
    SystemSounds.Exclamation.Play();  
}  

Compiling the Code

This example requires:

See also