错误信息: 索引超出范围。必须为非负值并小于集合大小。 参数名: index System.ArgumentOutOfRangeException

妈咿呀嘿 2017-10-20 11:30:10
错误信息:

索引超出范围。必须为非负值并小于集合大小。
参数名: index

System.ArgumentOutOfRangeException
能看出来具体导致这个异常ArgumentOutOfRangeException出错的位置吗?
Stack Trace:
在 System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index)
在 Crownwood.Magic.Collections.TabPageCollection.get_Item(Int32 index)
在 Crownwood.Magic.Controls.TabControl.RecalculateSinglelineTabs(Int32 xWidth, Int32 xStartPos, Rectangle tabPosition)
在 Crownwood.Magic.Controls.TabControl.Recalculate()
在 Crownwood.Magic.Controls.TabControl.OnSizeChanged(EventArgs e)
在 System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
在 System.Windows.Forms.Control.UpdateBounds()
在 System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
在 System.Windows.Forms.UserControl.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


...全文
3018 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
雨露天泽 2018-05-01
  • 打赏
  • 举报
回复
如果使用了DataGridVieW控件 赋值时要数据源 VB.net中 dgvPrint.DataSource = table table 返回表的名 或者添加 列和行。
妈咿呀嘿 2017-10-22
  • 打赏
  • 举报
回复
多谢大家帮忙解答了,这个主要是试用了第三方插件,所以我找不到它内部的错误。
妈咿呀嘿 2017-10-20
  • 打赏
  • 举报
回复
能看出来具体导致这个异常ArgumentOutOfRangeException出错的位置吗?
peng2739956 2017-10-20
  • 打赏
  • 举报
回复
这种 应该是属于比较基础的错误吧, 调试代码不就知道了吗
妈咿呀嘿 2017-10-20
  • 打赏
  • 举报
回复
啊啊啊啊啊啊啊啊啊啊
妈咿呀嘿 2017-10-20
  • 打赏
  • 举报
回复

操作:通过1234567这样的顺序将图上的7个框挨个点一遍之后,对数据查询或其它的选项进行惦记时就会出现这个错误!!!!,并且我加端点运行调试,发现在运行过程中并没有对应的index这样的参数,只有在加载窗体的时候有,但是加载时的数组值并不会对我操作程序时造成影响。
  • 打赏
  • 举报
回复
设置断点调试!
hwyqy 2017-10-20
  • 打赏
  • 举报
回复
自己去调试了,肯定是索引值有问题
正怒月神 版主 2017-10-20
  • 打赏
  • 举报
回复
我的天。。。。可能楼主不会调试? 代码没报错,不代表运行后不报错。 4#已经举例了。这个需要你自己去调试。
danny_2020 2017-10-20
  • 打赏
  • 举报
回复
当前检索的index 超过了list 的范围
妈咿呀嘿 2017-10-20
  • 打赏
  • 举报
回复
错误信息: 索引超出范围。必须为非负值并小于集合大小。 参数名: index System.ArgumentOutOfRangeException 能看出来具体导致这个异常ArgumentOutOfRangeException出错的位置吗? Stack Trace: 在 System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index) 在 Crownwood.Magic.Collections.TabPageCollection.get_Item(Int32 index) 在 Crownwood.Magic.Controls.TabControl.RecalculateSinglelineTabs(Int32 xWidth, Int32 xStartPos, Rectangle tabPosition) 在 Crownwood.Magic.Controls.TabControl.Recalculate() 在 Crownwood.Magic.Controls.TabControl.OnSizeChanged(EventArgs e) 在 System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight) 在 System.Windows.Forms.Control.UpdateBounds() 在 System.Windows.Forms.Control.WmWindowPosChanged(Message& m) 在 System.Windows.Forms.Control.WndProc(Message& m) 在 System.Windows.Forms.ScrollableControl.WndProc(Message& m) 在 System.Windows.Forms.ContainerControl.WndProc(Message& m) 在 System.Windows.Forms.UserControl.WndProc(Message& m) 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 以上式唯一的错误提示! 代码没报错,所以我找不到具体导致错误的位置。
正怒月神 版主 2017-10-20
  • 打赏
  • 举报
回复
如果数组长度为5,那么下标是0-4,你如果使用了下标100,那就会报错。 具体情况,就应该调试。
exception92 2017-10-20
  • 打赏
  • 举报
回复
自己调试程序就能看出来了
LWHLOVECD 2017-10-20
  • 打赏
  • 举报
回复
看不出来,上代码啊,应该有代码报错的,这个问题应该就是索引值有问题,你是不是对一个没有注明长度的数组进行使用,而且没有判断这个数组的长度。

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧