当前位置:编程学习 > C#/ASP.NET >>

C#在textbox1输入ID回车键显示数据库的内容分别显示在textbox2,textbox3,textbox4

C#在textbox1输入ID回车键显示数据库的内容分别显示在textbox2,textbox3,textbox4,急急,要有代码。 --------------------编程问答-------------------- 在textbox1加上回车事件处理不就好了 --------------------编程问答--------------------
目测是作业题目
private void button1_Click(object sender, EventArgs e)
        {
            textbox2.Text=textbox1.Text;
            textbox3.Text=textbox1.Text;
            textbox4.Text=textbox1.Text;
        }
--------------------编程问答-------------------- winform?
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                //这里的赋值可以从数据库中提取
                this.textBox2.Text = "2";
                this.textBox3.Text = "3";
                this.textBox4.Text = "4";
            }
        }
--------------------编程问答--------------------
引用 2 楼 god3cod6 的回复:

目测是作业题目
private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                textbox2.Text = textbox1.Text;
                textbox3.Text = textbox1.Text;
                textbox4.Text = textbox1.Text;
            }
        }

没看到题目 以为是按钮呢 --------------------编程问答--------------------
引用 3 楼 guwei4037 的回复:
winform?
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                //这里的赋值可以从数据库中提取
                this.textBox2.Text = "2";
                this.textBox3.Text = "3";
                this.textBox4.Text = "4";
            }
        }
+1
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,