求助:combobox选择一个值,将值显示在textbox中,如何实现多次选择的结果都显示在其中 combobox选择一个值,将值显示在textbox中,如何实现多次选择的结果都显示在其中,用“,”隔开。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 每次选择的结果,通过字符串拼接显示到textbox中即可啊,判断textbox中是否有内容,有内容,textbox.Text = textbox.Text + "," + combobox.Text; private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { textbox.Text = textbox.Text + "," + combobox.Text; } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if(textbox.Text.Trim()!="") { textBox1.AppendText("," + combobox.Text); } else { textbox.Text =combobox.Text; } } textBox1.Text += comboBox1.Text + ",";textBox1.SelectionStart = textBox1.Text.Length;//避免光标在输入字母的前面这个是按照添加顺序显示。最后处理一下最后一位是, private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { textbox.Text += "," + combobox.Text; } 哦 我意思是想显示到comboBox1.Text里面行不通! 应该如何做,才能把串接好的内容显示到comboBox1.Text里面?而而不是显示到另外一个控件里面。 c#如何在未下载完成的任务? 再问在C#中保存单击画的线为一个文件的问题 asp.net调试技巧,谢谢大家哦 求一段sql,急! 初学C#:请问如何定义函数? 附加自动命名的数据库,但失败。已存在同名的数据库,或指定的文件无法打开或位于 UNC 共享目录中。 如何使c#开发的程序界面支持多国语言? 我要怎样在WinForm控件中或ASP.NET中引用样式表中的样式 求教,关于属性set的迷惑 C#如何读取非UTF-8的字符? Invoke、InvokeMember提示“调用的目标发生了异常” socket问题请教 cannot access a disposed object
textbox.Text = textbox.Text + "," + combobox.Text;
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
textbox.Text = textbox.Text + "," + combobox.Text;
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if(textbox.Text.Trim()!="")
{
textBox1.AppendText("," + combobox.Text);
}
else
{
textbox.Text =combobox.Text;
}
}
textBox1.SelectionStart = textBox1.Text.Length;//避免光标在输入字母的前面
这个是按照添加顺序显示。最后处理一下最后一位是,
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
textbox.Text += "," + combobox.Text;
}