关于TextBox的问题 ListBox中有N个用户双击Item是将选择的用户名添加到TextBox效果如下 用户1;用户2;用户3;(Item的值为用户1 用户2 用户3我现在想实现的就是当我们再双击用户1时textBox中删除用户1;剩下用户2;用户3; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 双击时记下 Item的值 比如 :"用户1"判断 textBox.Text中是否有 "用户1;"如果没有 textBox.Text 中添加 "用户1;"如果有 textBox.Text 中 "用户1;" 用"" 取代 private void listBox1_DoubleClick(object sender, System.EventArgs e){ string str=listBox1.SelectedItem.ToString()+";"; int i=this.textBox1.Text.IndexOf(str); if (this.textBox1.Text.IndexOf(str)==-1) { this.textBox1.Text=this.textBox1.Text+str; } else { this.textBox1.Text=this.textBox1.Text.Replace(str,""); }} asp.net 关于时间日期控件的问题 求助~汉字莫名旋转90度 vs2005中的CreatUserWizard控件如何添加额外的内容? 事务只支持数据库吗?其它操作可以定义事务吗? ListBox问题 C# 查询 出问题···· 在C#中怎样调用word中的textbox、label一类的控件? 100分问一个非技术的vs.net的问题. 关于刷新窗体的问题,在线等 如何在windows窗体中得到网络上知道地址的文件? 如何在dataGrid中把comboBox添加进去? 用ADO.NET,用存储过程返回多个结果集问题?谢谢,请进
判断 textBox.Text中是否有 "用户1;"
如果没有 textBox.Text 中添加 "用户1;"
如果有 textBox.Text 中 "用户1;" 用"" 取代
{
string str=listBox1.SelectedItem.ToString()+";";
int i=this.textBox1.Text.IndexOf(str);
if (this.textBox1.Text.IndexOf(str)==-1)
{
this.textBox1.Text=this.textBox1.Text+str;
}
else
{
this.textBox1.Text=this.textBox1.Text.Replace(str,"");
}
}