iCount = this.lsvInforList.SelectedItems.Count;
try 
{  for (int i=iCount; i>0; i-- ) 
  {      this.lsvInforList.Items.Remove( this.lsvInforList.SelectedItems[i-1] );
   }
}

catch ( ArgumentOutOfRangeException aofEx ) 
{
    Console.Write ( aofEx.Message ); 
}
catch ( Exception Ex ) 
{
   Console.Write ( Ex.Message );
}this.lsvInforList.Refresh();

解决方案 »

  1.   

    第一、LISTVIEW问题
    iCount = this.lsvInforList.SelectedItems.Count;
    应改为: iCount = this.lsvInforList.SelectedItems[0].SubItems.Count;
    第二、DATAGRID 问题
    建议你把有关DataGrid的代码先注释掉,只保留数据连接显示的代码,在测试,如果还出现bug的话我想应该时DataGrid控件本身的Bug
      

  2.   

    try 
    {  for (int i=iCount; i>0; i-- ) 
      {
          ListViewItem lviInfoList= this.lsvInforList.Items.Items[i];
          lviInfoList.Remove();
       }
    }
      

  3.   

    但是如果我在这句代码this.lsvInforList.Items.Remove( this.lsvInforList.SelectedItems[i-1] );前加一句
    MessageBox.show ( "ddddddddddddd" );它就不会引发错误!!!!!!!!!!!!!!
    但这不是解决办法阿!!心中永远的痛!!!!!!!!!!!!!!!