???如何实现两个文本框的数据同步问题??? 比如在textBox1输入数据的同时,textBox2自动同时显示textBox1的数据?通俗一点,就是textBox1里有什么变化,textBox2如何变化? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在textBox1的TextChange事件中寫上textBox2.text = textBox1.text. private bool m_Changed = false;private void textBox1_TextChanged(object sender, EventArgs e){ if (!m_Changed) { textBox2.Text = this.textBox1.Text; m_Changed = false; }}private void textBox2_TextChanged(object sender, EventArgs e){ if (!m_Changed) { textBox1.Text = this.textBox2.Text; m_Changed = false; }} 不用我上面的那么复杂,private void textBox1_TextChanged(object sender, EventArgs e){ textBox2.Text = this.textBox1.Text;}private void textBox2_TextChanged(object sender, EventArgs e){ textBox1.Text = this.textBox2.Text;}但如果是下拉列表框等的话就要防止事件死循环。 不设置AutoPostBack = true,有没有不提交服务器的方法? c# 读取ini 文件得不到里面的值怎么回事??? VS2008与WIN7的问题 什么是构造函数和方法的重载,有没有区别 C# 连接 到SQL 请教一个问题,谢谢各位高手帮帮我!~ C# winform 单据保存. 求InstallShield x下载地址(带注册机) 很基础但是没解决的问题:indexof 获取DatagridView列的图片 请问遇到这样的问题该如何解决呢? 如何提示用户等待 picturebox上显示带连接的文字
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (!m_Changed)
{
textBox2.Text = this.textBox1.Text;
m_Changed = false;
}
}private void textBox2_TextChanged(object sender, EventArgs e)
{
if (!m_Changed)
{
textBox1.Text = this.textBox2.Text;
m_Changed = false;
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
textBox2.Text = this.textBox1.Text;
}private void textBox2_TextChanged(object sender, EventArgs e)
{
textBox1.Text = this.textBox2.Text;
}
但如果是下拉列表框等的话就要防止事件死循环。