想用C#窗体应用程序实现,在一个Textbox中输入完成后,按下回车键,开始执行自己写好的方法。
private void TextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == Convert.ToChar(System.Windows.Forms.Keys.Enter))
{
if(this.TextBox.Text == "完成")
{
method();
}
}
}
给textbox添加keypress事件,检测输入