111,125
社区成员
发帖
与我相关
我的任务
分享
int lbint = ListBox3.Items.Count;
string [] str=new string[]{ListBox1.SelectedValue.ToString(),ListBox2.SelectedItem.ToString()}
string str1=
string str2=
if (IsUnique(str))
{
ListItem item=new ListItem(str1+"—"+str2,str1+";"+str2);
ListBox3.Items.Add(item);
}
else
{
}
private bool IsUnique(string[] str)
{
bool bl=true;
foreach(ListItem item in ListBox3.Items)
{
string[] field = item.Value.Split(';');
if (str1==field[0])
{
bl=false;
break;
}
else if(str2==field[1])
{
bl=false;
break;
}
}
return bl;
}