textbox框联动 我有四个textbox框,如果在textbox1当中输入编号后,在textbox2,textbox3,textbox4里面会弹出对应的相关内容..请教大家方法,如果能有代码示例更好.谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 dt = fairy.GetSql("select type,unit,price,number,saveid from saveinfo where savename='" + id+ "'"); textBox1.Text = id; textBox2.Text = dt.Rows[0].ItemArray[0].ToString(); textBox3.Text = dt.Rows[0].ItemArray[1].ToString(); textBox4.Text = dt.Rows[0].ItemArray[2].ToString(); 可以自己写个控件可以把textBox和panel一些控件组合起来,我只能提示下不知道能不能帮上你 private void textBox1_TextChanged(object sender, EventArgs e){ dt = fairy.GetSql("select type,unit,price,number,saveid from saveinfo where savename='" + id+ "'"); textBox1.Text = id; textBox2.Text = dt.Rows[0].ItemArray[0].ToString(); textBox3.Text = dt.Rows[0].ItemArray[1].ToString(); textBox4.Text = dt.Rows[0].ItemArray[2].ToString(); } private void textBox1_TextChanged(object sender, EventArgs e) { dt = fairy.GetSql("select type,unit,price,number,saveid from saveinfo where savename='"+id+ "'"); textBox1.Text = id; textBox2.Text = dt.Rows[0].ItemArray[0].ToString(); textBox3.Text = dt.Rows[0].ItemArray[1].ToString(); textBox4.Text = dt.Rows[0].ItemArray[2].ToString(); } 不知道楼主有没有其他的数据源,如果没有的话只单纯的实现你说的功能就简单了: private void textBox1_TextChanged(object sender, EventArgs e) { if (this.textBox1.Text!="") { if (this.textBox1.Text == "1") { this.textBox2.Text = "11"; this.textBox3.Text = "111"; this.textBox4.Text = "1111"; } else if (this.textBox1.Text == "2") { this.textBox2.Text = "22"; this.textBox3.Text = "222"; this.textBox4.Text = "2222"; } else if (this.textBox1.Text == "3") { this.textBox2.Text = "33"; this.textBox3.Text = "333"; this.textBox4.Text = "3333"; } else if (this.textBox1.Text == "4") { this.textBox2.Text = "44"; this.textBox3.Text = "444"; this.textBox4.Text = "4444"; } } }如果有表之类的数据源的话,那个“走猪观花”的代码改下就ok了!楼主问题解决了给分啊,别整个“无满意回复结帖”让大家不爽!!! SendMessage 发送按键消息不成功 关于i++的问题!!!! 急求HTTP协议问题 C# 多线程 如何合并DataGrid中的行? 在线等待 如何使用WebService服务? 还是汉字乱码??? datagrid 如何防止用户点击back按钮回到受访问限制的网页上 那里有win2000 professional 的iis5.0下载,谢谢 如何让datagridview一列中的各行显示不同的图片 近来无聊的产物
textBox1.Text = id;
textBox2.Text = dt.Rows[0].ItemArray[0].ToString();
textBox3.Text = dt.Rows[0].ItemArray[1].ToString();
textBox4.Text = dt.Rows[0].ItemArray[2].ToString();
可以把textBox和panel一些控件组合起来,我只能提示下
不知道能不能帮上你
private void textBox1_TextChanged(object sender, EventArgs e)
{
dt = fairy.GetSql("select type,unit,price,number,saveid from saveinfo where savename='" + id+ "'");
textBox1.Text = id;
textBox2.Text = dt.Rows[0].ItemArray[0].ToString();
textBox3.Text = dt.Rows[0].ItemArray[1].ToString();
textBox4.Text = dt.Rows[0].ItemArray[2].ToString();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
dt = fairy.GetSql("select type,unit,price,number,saveid from saveinfo where savename='"+id+ "'");
textBox1.Text = id;
textBox2.Text = dt.Rows[0].ItemArray[0].ToString();
textBox3.Text = dt.Rows[0].ItemArray[1].ToString();
textBox4.Text = dt.Rows[0].ItemArray[2].ToString();
}
{
if (this.textBox1.Text!="")
{
if (this.textBox1.Text == "1")
{
this.textBox2.Text = "11";
this.textBox3.Text = "111";
this.textBox4.Text = "1111";
}
else if (this.textBox1.Text == "2")
{
this.textBox2.Text = "22";
this.textBox3.Text = "222";
this.textBox4.Text = "2222";
}
else if (this.textBox1.Text == "3")
{
this.textBox2.Text = "33";
this.textBox3.Text = "333";
this.textBox4.Text = "3333";
}
else if (this.textBox1.Text == "4")
{
this.textBox2.Text = "44";
this.textBox3.Text = "444";
this.textBox4.Text = "4444";
}
}
}如果有表之类的数据源的话,那个“走猪观花”的代码改下就ok了!
楼主问题解决了给分啊,别整个“无满意回复结帖”让大家不爽!!!