我想创建一个if语句来识别哪个字符串已从特定列表框中删除。我想我可以做一些类似下面的一个if语句,并得到它的工作,但它告诉我,它具有无效arguements - 如果有人能指导我会赞赏如何将selectedIndex与listBox中的字符串进行比较
private void button2_Click(object sender, EventArgs e)
{
listBox2.Items.RemoveAt(listBox2.SelectedIndex);
if(listBox2.Items.RemoveAt(listBox2.SelectedItems.ToString().Equals("Test")))
{
picturebox.Image = null;
}
}