BindingList<T>集合Remove(T)的时候, 出现提供的行索引超出范围异常 索引equals 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 感觉 你应该对obj 做个Null的判断 感觉应该是数据改动后没有刷新的问题当bindinglist中的值改变时触发这一事件,事件中写上dataGridView.RefreshEdit()刷新某单元格或者dataGridView.Refresh()全表刷新就不会出现数据改动滞后的现象。 移除的时候错误是肯定的,但移除不可能肯定是移除最后的一项,我这里用了BindingList<T>集合就是为了实时更新,更不可能在添加的时候才移除啦 null判断必须做了的,这里是精简的代码,想用最少的内容说明问题而已,这里的问题真心和对象是否null无关 在补充下错误异常日志:System.ArgumentOutOfRangeException: 提供的行索引超出范围。参数名: rowIndex 在 System.Windows.Forms.DataGridViewRowCollection.GetRowState(Int32 rowIndex) 在 System.Windows.Forms.DataGridView.OnRowGlobalAutoSize(Int32 rowIndex) 在 System.Windows.Forms.DataGridView.OnRowHeightChanged(DataGridViewRowEventArgs e) 在 System.Windows.Forms.DataGridView.OnBandThicknessChanged(DataGridViewBand dataGridViewBand) 在 System.Windows.Forms.DataGridViewBand.set_ThicknessInternal(Int32 value) 在 System.Windows.Forms.DataGridView.OnRemovedRow_PostNotification(DataGridViewRow dataGridViewRow, Point newCurrentCell) 在 System.Windows.Forms.DataGridViewRowCollection.OnCollectionChanged_PostNotification(CollectionChangeAction cca, Int32 rowIndex, Int32 rowCount, DataGridViewRow dataGridViewRow, Boolean changeIsDeletion, Boolean changeIsInsertion, Boolean recreateNewRow, Point newCurrentCell) 在 System.Windows.Forms.DataGridViewRowCollection.OnCollectionChanged(CollectionChangeEventArgs e, Int32 rowIndex, Int32 rowCount, Boolean changeIsDeletion, Boolean changeIsInsertion, Boolean recreateNewRow, Point newCurrentCell) 在 System.Windows.Forms.DataGridViewRowCollection.RemoveAtInternal(Int32 index, Boolean force) 在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.ProcessListChanged(ListChangedEventArgs e) 在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.currencyManager_ListChanged(Object sender, ListChangedEventArgs e) 在 System.Windows.Forms.CurrencyManager.OnListChanged(ListChangedEventArgs e) 在 System.Windows.Forms.CurrencyManager.List_ListChanged(Object sender, ListChangedEventArgs e) 在 System.ComponentModel.BindingList`1.OnListChanged(ListChangedEventArgs e) 在 System.ComponentModel.BindingList`1.FireListChanged(ListChangedType type, Int32 index) 在 System.ComponentModel.BindingList`1.RemoveItem(Int32 index) 在 System.Collections.ObjectModel.Collection`1.Remove(T item) 多线程下产生无重复随机数 关于c# 自动生成不需要的文件夹 三层结构 关于财政局的内务系统 网站 磁盘配额问题 关于WebGrid 送100分问题!!! 请问:怎么把某个目录下的所有文件和目录拷贝到指定路径下。 C# DirectoryInfo的路径问题 ArrayList的问题,很困惑。请高手指点下 问WinForm下DataGrid怎样刷新数据的问题!!!! 一个简单的SQL语句 提示"对象名无效" 要怎么弄,请会的帮忙看看,谢谢!
当bindinglist中的值改变时触发这一事件,事件中写上
dataGridView.RefreshEdit()刷新某单元格
或者
dataGridView.Refresh()全表刷新
就不会出现数据改动滞后的现象。
移除的时候错误是肯定的,但移除不可能肯定是移除最后的一项,我这里用了BindingList<T>集合就是为了实时更新,
更不可能在添加的时候才移除啦
null判断必须做了的,这里是精简的代码,想用最少的内容说明问题而已,这里的问题真心和对象是否null无关
System.ArgumentOutOfRangeException: 提供的行索引超出范围。
参数名: rowIndex
在 System.Windows.Forms.DataGridViewRowCollection.GetRowState(Int32 rowIndex)
在 System.Windows.Forms.DataGridView.OnRowGlobalAutoSize(Int32 rowIndex)
在 System.Windows.Forms.DataGridView.OnRowHeightChanged(DataGridViewRowEventArgs e)
在 System.Windows.Forms.DataGridView.OnBandThicknessChanged(DataGridViewBand dataGridViewBand)
在 System.Windows.Forms.DataGridViewBand.set_ThicknessInternal(Int32 value)
在 System.Windows.Forms.DataGridView.OnRemovedRow_PostNotification(DataGridViewRow dataGridViewRow, Point newCurrentCell)
在 System.Windows.Forms.DataGridViewRowCollection.OnCollectionChanged_PostNotification(CollectionChangeAction cca, Int32 rowIndex, Int32 rowCount, DataGridViewRow dataGridViewRow, Boolean changeIsDeletion, Boolean changeIsInsertion, Boolean recreateNewRow, Point newCurrentCell)
在 System.Windows.Forms.DataGridViewRowCollection.OnCollectionChanged(CollectionChangeEventArgs e, Int32 rowIndex, Int32 rowCount, Boolean changeIsDeletion, Boolean changeIsInsertion, Boolean recreateNewRow, Point newCurrentCell)
在 System.Windows.Forms.DataGridViewRowCollection.RemoveAtInternal(Int32 index, Boolean force)
在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.ProcessListChanged(ListChangedEventArgs e)
在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.currencyManager_ListChanged(Object sender, ListChangedEventArgs e)
在 System.Windows.Forms.CurrencyManager.OnListChanged(ListChangedEventArgs e)
在 System.Windows.Forms.CurrencyManager.List_ListChanged(Object sender, ListChangedEventArgs e)
在 System.ComponentModel.BindingList`1.OnListChanged(ListChangedEventArgs e)
在 System.ComponentModel.BindingList`1.FireListChanged(ListChangedType type, Int32 index)
在 System.ComponentModel.BindingList`1.RemoveItem(Int32 index)
在 System.Collections.ObjectModel.Collection`1.Remove(T item)