How to: Play a Beep from a Windows Form
This example plays a beep at run time.
Example
Public Sub OnePing()
Beep()
End Sub
public void onePing()
{
SystemSounds.Beep.Play();
}
Note
The sound played in the C# code sample is determined by the Beep system sound setting. For more information, see SystemSounds.
Compiling the Code
For C#, 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
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for