求助C# System.IndexOutOfRangeException: 索引超出了数组界

loyedante 2009-08-11 10:14:31
本人在C#是个小白 最近做了个WINFORM程序遇到一个比较奇怪的问题 ,在自己机器编译,运行都没问题,但是到了别人那里就出现了
************** 异常文本 **************
System.IndexOutOfRangeException: 索引超出了数组界限。
at CMSystemCS.Form1.checkContract() in e:\project\cmsystemwebapplication\cmsystemcs\form1.cs:line 377
at CMSystemCS.Form1.button2_Click(Object sender, EventArgs e) in e:\project\cmsystemwebapplication\cmsystemcs\form1.cs:line 243
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** JIT 调试 **************
计算机的配置文件(machine.config)的
system.windows.forms 节中必须设置 jitDebugging 值。
编译应用程序时还必须启用\r\n调试。\r\n\r\n例如: \r\n\r\n<configuration>\r\n <system.windows.forms jitDebugging="true" />\r\n</configuration>\r\n\r\n启用 JIT 调试后,任何未处理的异常\r\n都将被发送到此计算机上注册的 JIT 调试器,\r\n而不是由此对话框处理。\r\n

这样的问题
...全文
1081 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lingxizhixia 2009-08-11
  • 打赏
  • 举报
回复
从上述异常提示文本来看,CMSystemCS.Form1.checkContract() 方法以及CMSystemCS.Form1.button2_Click 方法内部代码出现了异常。具体出错位置分别在243行 377行,你仔细推敲一下这两行代码。可以在这两行之前插入输出语句,将程序运行过程中的参数输出,看看参数是否有误。或者是看看能否换个方法实现这两行的功能。试试看吧,实在不行可以将你这两个方法的代码粘贴出来,大家一块瞧瞧
loyedante 2009-08-11
  • 打赏
  • 举报
回复
哦 谢谢
dancingbit 2009-08-11
  • 打赏
  • 举报
回复
CMSystemCS.Form1.button2_Click(Object sender, EventArgs e)

这个方法中出现了数组下标越界。
wuyi8808 2009-08-11
  • 打赏
  • 举报
回复
检查一下 checkContract() 里面的代码。

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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