.netwinformsbeep

Avoid Windows 'Ding' when Enter is pressed in TextBox with OnKeyUp


If a user hits enter in a windows forms textbox with a KeyUp Event, windows sounds a beep or ding. I could not determine why this happens and how I could avoid this.

Any help would be appreciated.


Solution

  • I imagine this is caused by a combination of:

    because single-line textboxes forward the enter key to the default button. The ding is generated when a default button can't be found.