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 SystemSounds.
Example
Public Sub PlayExclamation()
SystemSounds.Exclamation.Play()
End Sub
public void playExclamation()
{
SystemSounds.Exclamation.Play();
}
Compiling the Code
This example requires:
- A reference to the System.Media namespace.
See also
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET Desktop feedback