- C# code
private void TextBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { //这里要让它激发 Buttonl_Click 事件 忘了怎么写 } } private void Buttonl_Click(object sender, EventArgs e) { ....................... }
------解决方案--------------------------------------------------------
button1.PerformClick();
------解决方案--------------------------------------------------------
Buttonl_Click(Button1,null)