Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable the c# message box beep?

Tags:

c#

.net

winforms

Whenever trigger a messagebox used in my C# program I get a very annoying beep from my computer. How do I disable this beep using C# code.

The code I am using is very simple.

MessageBox.show("text");
like image 897
JK. Avatar asked Nov 15 '09 21:11

JK.


2 Answers

From the searching I've done it looks like the beep is hardwired into the Win32 message box function:

  • Bytes
  • VB Forums

So you need to either write your own method or stop the beep in the hardware. The former will work for everyone, the latter just for you.

like image 82
ChrisF Avatar answered Sep 21 '22 00:09

ChrisF


This is going to sound weird until you have tried it. Open your command prompt, type:

net stop beep

I did a quick google and found 4 other ways:

  1. local machine: sc stop beep && sc config beep start= disabled
  2. remote machine: sc \remoteMachine stop beep && sc \remoteMachine config beep start= disabled
  3. requires reboot: Device Manager -> View -> Show Hidden Devices -> Non Plug and Play -> Beep -> Disable
  4. use TweakUI: General > Settings -> Uncheck the Beep on Errors

(from here)

like image 25
Christian Payne Avatar answered Sep 19 '22 00:09

Christian Payne