如何在C#中同时在2个文本框中输入值 [英] How to enter values in 2 textboxes at same time in C#

查看:538
本文介绍了如何在C#中同时在2个文本框中输入值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个文本框.在textbox1中输入值时,也应在textbox2中输入值.有人可以帮我吗?

I have 2 textboxes. While entering the values into textbox1, it should also be entered in textbox2. Can anyone help me?

推荐答案



很简单,只需订阅第一个文本框的TextChange事件,然后使用此代码:

Hi,

that''s easy, just subscribe the TextChange event of your first textbox and then use this code:

private void textBox1_TextChanged(object sender, EventArgs e)
{
  textBox2.Text = textBox1.Text;
}


这篇关于如何在C#中同时在2个文本框中输入值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆