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();
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();
iCount = this.lsvInforList.SelectedItems.Count;
应改为: iCount = this.lsvInforList.SelectedItems[0].SubItems.Count;
第二、DATAGRID 问题
建议你把有关DataGrid的代码先注释掉,只保留数据连接显示的代码,在测试,如果还出现bug的话我想应该时DataGrid控件本身的Bug
{ for (int i=iCount; i>0; i-- )
{
ListViewItem lviInfoList= this.lsvInforList.Items.Items[i];
lviInfoList.Remove();
}
}
MessageBox.show ( "ddddddddddddd" );它就不会引发错误!!!!!!!!!!!!!!
但这不是解决办法阿!!心中永远的痛!!!!!!!!!!!!!!!