在labelcontrol中的"for"循环中显示每个值 [英] Display Each Value Inside A 'for' Loop In labelcontrol
本文介绍了在labelcontrol中的"for"循环中显示每个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的代码
I have a code like this
for(int i=0;i<count;i++)>
{
string k=item[i];
}
我想将每个"k"值添加到labelcontrol.如果我有10个"k"值,那么我想在Label控件中显示10个值.
I want to add each value of ''k'' to a labelcontrol..If I have 10 values for ''k'' then I want to display in a Label control with 10 values..How can I do this?..
推荐答案
使用中继器 http://www.w3schools. com/aspnet/aspnet_repeater.asp [ ^ ]
尝试这样的事情
Hi,
Try Something like this
for(int i=0;i<count;i++)>
{
Label lbl[i]= new Label();
string k=item[i];
lbl[i].Text=k;
}
for(int i = 0; i< count; i ++)>
{
label1.Text + =& nbsp;" + item [i];//label1是标签的ID
}
for(int i=0;i<count;i++)>
{
label1.Text +=" "+ item[i];//label1 is the id of your label
}
这篇关于在labelcontrol中的"for"循环中显示每个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文