十万火急! 三个文本框,textbox1,textbox2,textbox3,初始化时候给textbox3一个字符串,比如000000,如果现在需要在改变textbox1里文本的时候,textbox3前三个字符跟这变化,改变textbox2的时候后三位跟着变化,该怎么解决。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 textbox1的textchanged事件:textbox3.text = textbox1.text + textbox3.text.substring(3,6)textbox2的textchanged事件:textbox3.text = textbox3.text.substring(0,3) + textbox2.text public Form1() { InitializeComponent(); this.textBox3.Text = "000000"; } private void textBox1_TextChanged(object sender, EventArgs e) { this.textBox3.Text = this.textBox1.Text.PadLeft(3, '0') + this.textBox3.Text.Substring(3, 3); } private void textBox2_TextChanged(object sender, EventArgs e) { this.textBox3.Text = this.textBox3.Text.Substring(0, 3) + this.textBox2.Text.PadRight(3, '0'); } 一楼的问题多多,如果1,2两个textbox没有输满三位会出现什么问题。思路是对的。 求一个WPF下图像浏览器的聚光灯效果 VS2010 的宏定义问题 新手求解 请问try catch里面可以套try catch吗? 我想深拷贝一个List,怎么实现不了呢 接口里可以定义委托吗? VB 翻译C# 在线等待!!! C#下在vs2010中的导出数据到Excel中 vs2005 引包功能 改错功能 切换标记功能??? c#用GDI+绘制文字(DrawString),实现选择其中一个字符功能 请问是否有免费的: 查看IGS或STP等通用格式的控件? C#的参数传递 关于ADO.NET 中Updata的问题
textbox3.text = textbox1.text + textbox3.text.substring(3,6)
textbox2的textchanged事件:
textbox3.text = textbox3.text.substring(0,3) + textbox2.text
{
InitializeComponent();
this.textBox3.Text = "000000";
} private void textBox1_TextChanged(object sender, EventArgs e)
{
this.textBox3.Text = this.textBox1.Text.PadLeft(3, '0') + this.textBox3.Text.Substring(3, 3);
} private void textBox2_TextChanged(object sender, EventArgs e)
{
this.textBox3.Text = this.textBox3.Text.Substring(0, 3) + this.textBox2.Text.PadRight(3, '0');
}