How can I make the computer beep in C#?

Use System.Media.SystemSounds to get the sounds for various events, then Play them:

System.Media.SystemSounds.Beep.Play();
System.Media.SystemSounds.Asterisk.Play();
System.Media.SystemSounds.Exclamation.Play();
System.Media.SystemSounds.Question.Play();
System.Media.SystemSounds.Hand.Play();

In .Net 2.0, you can use Console.Beep.

// Default beep
Console.Beep();

You can also specify the frequency and length of the beep in milliseconds.

// Beep at 5000 Hz for 1 second
Console.Beep(5000, 1000);

Tags:

C#

.Net

Audio

Beep