Winform 中的listBox控件,数据源是数组,怎样在移除被选中的项,请大家赐教!! foreach(ListItem item in lstBox.SelectedItems){ lstBox.Items.Remove(item);} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 listBox1.Items.RemoveAt(listBox1.SelectedIndex); foreach(ListItem item in lstBox.SelectedItems){ lstBox.Items.Remove(item);}这种也不行,winform中没有listItem 那就直接从你的数组中删除选中的数据项,然后再重新绑定到listBox 先循环找到当前选种项的值再通过ListBox.Items.Remove()删除int intindex=lstBox.SelectedIndex;lstBox.Items.Remove(lstBox.Items[intindex]); 再删除前先要做判断if (lstBox.SelectedIndex < lstBox.Items.Count){ if (lstBox.SelectedIndex < lstBox.Items.Count-1) { int intindex=lstBox.SelectedIndex; lstBox.Items.Remove(lstBox.Items[intindex]); }} serialPort.ReadLine()一执行就死机,Why? 关于打印机设置的问题!!!!!急!!!!! c#裏XML用XPATH取節點。。。請教高手。。。Pls....(重復) XML。。 求教打字游戏(1) 大家看看这段代码哪里有问题??? Datagrid问题 我想在局域网内共享音响,大家有什么好的办法? Studio.NET的奇怪现象 select语句 1000分求高手帮忙!!!!关于vc#操作oracle数据库bolb字段问题,谢谢 又一个WebService问题!!急
{
lstBox.Items.Remove(item);
}这种也不行,winform中没有listItem
再通过ListBox.Items.Remove()删除int intindex=lstBox.SelectedIndex;
lstBox.Items.Remove(lstBox.Items[intindex]);
{
if (lstBox.SelectedIndex < lstBox.Items.Count-1)
{
int intindex=lstBox.SelectedIndex;
lstBox.Items.Remove(lstBox.Items[intindex]);
}
}