我写的定时函数
ListViewItem item = new ListViewItem();
bool b1 = false;
string[] strTagID = GetTagID();
for (int j = 0; j < strTagID.Length; j++)
{
for (int i = 0; i < listView1.Items.Count; i++)
{ if (listView1.Items[i].Text == strTagID[j])
{
b1 = true;
break;
}
}
if (b1 == false && strTagID[j].Length > 1 && timerGetTag.Enabled == true)
{
item = new ListViewItem(strTagID[j]);
listView1.Items.AddRange(new ListViewItem[] { item });
}
}
按理说应该是有了新内容,添加到listview1里面去,原内容不变啊。可是问题是现在是每次都先清空了listview1里的内容才往里写。这是怎么回事呢?请教各位大侠啊
ListViewItem item = new ListViewItem();
bool b1 = false;
string[] strTagID = GetTagID();
for (int j = 0; j < strTagID.Length; j++)
{
for (int i = 0; i < listView1.Items.Count; i++)
{ if (listView1.Items[i].Text == strTagID[j])
{
b1 = true;
break;
}
}
if (b1 == false && strTagID[j].Length > 1 && timerGetTag.Enabled == true)
{
item = new ListViewItem(strTagID[j]);
listView1.Items.AddRange(new ListViewItem[] { item });
}
}
按理说应该是有了新内容,添加到listview1里面去,原内容不变啊。可是问题是现在是每次都先清空了listview1里的内容才往里写。这是怎么回事呢?请教各位大侠啊
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货