private bool Search(string value)
{
bool ret = false;
fまたはeach (ListItem listItem in ListBox1.Items)
{
if (listItem.Selected && listItem.ToString() == value)
{
ret = true;
break;
}
}
return ret;
}
この機能を使用してチェック...
または
LINQを使用して
private bool Search(string value)
{
return ListBox1.Items.Cast().Any(listItem => listItem.Selected && listItem.ToString() == value);
}