我需要将comapnies追加到文本框中 [英] I need to append the comapnies to textbox
本文介绍了我需要将comapnies追加到文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
代码如下:
the code is given below
if(result.Count>0)
{
foreach(var a in result)
{
txttag.TextBoxValue = a.CompanyName;
}
}
结果包含两项,comapny名字得到了最后一个comapny名字
我尝试过:
将公司名称附加到文本框
the result contains two items,comapny name got the last comapny name
What I have tried:
append the companyname to text box
推荐答案
嗨!你的代码似乎很好。试试这个。
Hi! your code seems fine. just try this one.
if(result.Count>0)
{
foreach(var a in result)
{
txttag.TextBoxValue += a.CompanyName +"\n";
}
}
you每个新公司添加后都会有新的一行。
这可能会有所帮助。
谢谢。
you will have new line after each new company added.
this can be helpful.
Thanks.
你可以这样做给出如下
if(result.Count> 0)
{
StringBuilder strresult = new StringBuilder();
foreach(结果中的var a)
{
strresult .Append(a.CompanyName)
}
txttag.TextBoxValue = strresult.ToString();
}
you can do some this like given below
if(result.Count>0)
{
StringBuilder strresult = new StringBuilder();
foreach(var a in result)
{
strresult.Append(a.CompanyName)
}
txttag.TextBoxValue = strresult.ToString();
}
这篇关于我需要将comapnies追加到文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文