How to play Beep in window application

If you want to play beep sound on the few some situation such as at the time of the application start up or at the time of displaying an error message or any notification in the application. You can use Beep property of the System.Media.SystemSounds class. Beep sound depends on the current Windows sound scheme.

Example

The following example will show how we can use Beep property at the time of windows form load.

[vb.net]

Private Sub Form1_Load(ByVal sender As System.Object,
                           ByVal e As System.EventArgs) Handles MyBase.Load
        System.Media.SystemSounds.Beep.Play()
End Sub

[C#]

private void Form1_Load(object sender, EventArgs e)
{
      SystemSounds.Beep.Play();
}

You can use the above code of line where you want to play the beep sound.