2014-09-27 65 views
0

我在按下文本框中的Enter鍵時消除了蜂鳴聲的問題。c#避免在KeyDown按下發出嗶嗶聲?

這不起作用:

private void textBox3_KeyDown(object sender, KeyEventArgs e) 
    { 

     if (e.KeyCode == Keys.Enter) 
     { 
      e.SuppressKeyPress = true; 
      button1.PerformClick();    
     } 

    } 

回答

0

我找到答案!

private void textBox2_KeyDown(object sender, KeyEventArgs e) 
     { 
      //Pressing ENTER 
      if (e.KeyCode == Keys.Enter) 
      { 
       button1.Select(); 
       e.SuppressKeyPress = true; 
       SendKeys.Send("{ENTER}");    
      } 

     }