把文本框一的字输出到文本框2里面,当按回车键的时候将文本框1的内容整行输到文本框2中,类似于QQ聊天
还有我想弱弱的问一下,有没有e.keyChar这个东西啊,我上课看我们老师写不明白是什么意思

解决方案 »

  1.   

    private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
    {
    这里才有e.KeyChar
    }
      

  2.   


            private void textBox1_KeyDown(object sender, KeyEventArgs e)
            {
                if(e.KeyData==Keys.Enter)
                {
                    textBox2.Text = textBox1.Text;
                }
            }
    //或者        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar==13)
                {
                    textBox2.Text = textBox1.Text;
                }
            }