2016-08-12 47 views

回答

0

使用上KeyPress事件TextBox.PerformClick()方法驗證按鍵是否Enter

private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) 
{ 
    // Check if pressed key is `Enter` key 
    if (e.KeyChar == (char)Keys.Return){ 
     button1.PerformClick(); 
    } 
} 
相關問題