积极答复者
应用程序出错,求解决方法

问题
-
有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。
************** 异常文本 **************
System.ArgumentOutOfRangeException: StartIndex 不能小于 0。
参数名: startIndex
在 System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
在 cnsigGMS.AppCode.common.Get_ID_From_String(String str, Int32 lastnum) 位置 E:\cs\AppCode\common.cs:行号 398
在 cnsigGMS.StockMag.frmBuyBill.btnSave_Click(Object sender, EventArgs e) 位置 E:\cs\StockMag\frmBuyBill.cs:行号 152
在 System.Windows.Forms.Control.OnClick(EventArgs e)
在 DevComponents.DotNetBar.ButtonX.OnClick(EventArgs e)
在 DevComponents.DotNetBar.ButtonX.OnMouseUp(MouseEventArgs e)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 DevComponents.DotNetBar.PopupItemControl.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)
************** 已加载的程序集 **************
mscorlib
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)
基本代码: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
cnsigGMS
程序集版本: 1.0.0.0
Win32 版本: 1.0.0.0
基本代码: file:///C:/Users/chenxiaobin/Desktop/Release/cnsigGMS.exe
----------------------------------------
System
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 built by: RTMRel
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 built by: RTMRel
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 built by: RTMRel
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
DevComponents.DotNetBar2
程序集版本: 8.7.0.3
Win32 版本: 8.7.0.3
基本代码: file:///C:/Users/chenxiaobin/Desktop/Release/DevComponents.DotNetBar2.DLL
----------------------------------------
Accessibility
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 built by: RTMRel
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Windows.Forms.resources
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 built by: RTMRel
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
System.Data
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Core
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 built by: RTMRel
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 built by: RTMRel
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Transactions
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
System.Numerics
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 built by: RTMRel
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
mscorlib.resources
程序集版本: 4.0.0.0
Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/mscorlib.resources.dll
----------------------------------------
Microsoft.VisualBasic.PowerPacks.Vs
程序集版本: 10.0.0.0
Win32 版本: 10.0.30319.1
基本代码: file:///C:/Users/chenxiaobin/Desktop/Release/Microsoft.VisualBasic.PowerPacks.Vs.DLL
----------------------------------------
Microsoft.VisualBasic
程序集版本: 10.0.0.0
Win32 版本: 10.0.30319.1 built by: RTMRel
基本代码: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
************** JIT 调试 **************
要启用实时(JIT)调试,
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
jitDebugging 值。
编译应用程序时还必须启用
调试。
例如:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
启用 JIT 调试后,任何未经处理的异常
都将被发送到在此计算机上注册的 JIT 调试器,
而不是由此对话框处理。
C#初学者,所以提的问题对各位前辈朋友来说可能很简单,也可能问法也不对,非常期待大家的回答……
答案
-
楼主,请仔细阅读异常信息:
System.ArgumentOutOfRangeException: StartIndex 不能小于 0。
参数名: startIndex
在 System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
在 cnsigGMS.AppCode.common.Get_ID_From_String(String str, Int32 lastnum) 位置通过粗体字,楼主应该可以判断出,是Get_ID_From_String 这个方法里截取字符串的时候,StartIndex小于了0,肯定是楼主的代码预设的分隔符之类的标识在传入的字符串中没有找到。
理解的越多,需要记忆的就越少- 已标记为答案 永远的小六 2010年12月8日 2:15
全部回复
-
楼主,请仔细阅读异常信息:
System.ArgumentOutOfRangeException: StartIndex 不能小于 0。
参数名: startIndex
在 System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
在 cnsigGMS.AppCode.common.Get_ID_From_String(String str, Int32 lastnum) 位置通过粗体字,楼主应该可以判断出,是Get_ID_From_String 这个方法里截取字符串的时候,StartIndex小于了0,肯定是楼主的代码预设的分隔符之类的标识在传入的字符串中没有找到。
理解的越多,需要记忆的就越少- 已标记为答案 永远的小六 2010年12月8日 2:15