Click here to Skip to main content
15,918,742 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
In my C# application sounds coming while I press enter in textboxes. How I mute that sounds. Mute only in my application. Not in system.

What I have tried:

I Googled but came with not suitable result
Posted
Updated 24-May-17 3:00am
v2
Comments
ZurdoDev 24-May-17 8:10am    
Where are the sounds coming from?
vijay_bale 24-May-17 8:11am    
default sounds from system. I want to mute in my application only.
ZurdoDev 24-May-17 8:13am    
Looks like this might work, https://stackoverflow.com/questions/6290967/stop-the-ding-when-pressing-enter

Personally, I would suggest against it. If a user has sounds on at the system level I don't think your app should ignore them.
Kornfeld Eliyahu Peter 24-May-17 8:44am    
I second that! The user may be blind as far as OP can know it...
vijay_bale 24-May-17 8:58am    
It Works for me
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{

//Se apertou o enter
if (e.KeyCode == Keys.Enter)
{
//enter key is down

this.doSomething();

e.Handled = true;
e.SuppressKeyPress = true;

}

}

As mentioned in comments, Looks like this might work, c# - Stop the 'Ding' when pressing Enter - Stack Overflow[^]

Personally, I would suggest against it. If a user has sounds on at the system level I don't think your app should ignore them. For example, as Peter pointed out, the user could be blind or have other accessibility issues.
 
Share this answer
 
Here also I am posting the same answer. Maybe It would help someone.

private void textBox1_KeyDown(object sender, KeyEventArgs e)
{

//Se apertou o enter
if (e.KeyCode == Keys.Enter)
{
//enter key is down

this.doSomething();//some commands you want to execute.

e.Handled = true;
e.SuppressKeyPress = true;

}

}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900