DEV Community

Cover image for Remove annoying beep from pressing enter in textbox
Adam K Dean
Adam K Dean

Posted on

1

Remove annoying beep from pressing enter in textbox

Continuing with useful snippets and methods, today I present you mighty readers with a very useful
and simple way to get rid of the annoying sound from pressing enter in a textbox. We've all had it, trying to make enter take us from the username, to the password, and then to the submit button.. but that sound.. must..claw..eyes..out... or ears.. but anyway, it's really easy, read and learn:

private void txtInput_KeyUp(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Enter)
    {
        e.SuppressKeyPress = true;
    }
}

private void txtInput_KeyPress(object sender, KeyPressEventArgs e)
{
    if (e.KeyChar == (char)Keys.Enter)
    {
        // any logic would go here
        e.Handled = true;
    }
}
Enter fullscreen mode Exit fullscreen mode

And there you have it. Very easy, very simple and very very useful.

Now for me, back to work, a friend of mine Mihn was talking to me about refactoring yesterday, little did he know he'd plant seeds that would grow into enormous fruitition* when I'd overhaul the whole administrator area of the new site at work and change it from web based to a desktop application.. damn you Mihner, damn you!

* I hearby declare fruitition a real word.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more