Playing system sounds: beep, asterisk, question, etc.

For my first example, I thought I’d post something simple yet very useful.

Sometimes you may want to make your program beep. It would be nice to just call a Beep method. Visual Basic has one but C# does not.

You could use Console.Beep() but that produces a loud, jarring sound that doesn’t fit in well with modern Windows programming.

The solution is to use the System.Media.SystemSounds classes.

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

   

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments
  • No comments exist for this post.
Leave a comment

Submitted comments are subject to moderation before being displayed.

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.