日期:2014-05-20  浏览次数:20875 次

C# keypress 事件激发 Click 事件


        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)