指数超出范围的例外? [英] index out of range exeption?
本文介绍了指数超出范围的例外?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个超出范围的索引在这个上面
i''ve got an index out of range exeption on this one
If My.Settings.SavedLinks IsNot Nothing Then
For Each Sl As String In My.Settings.SavedLinks
Dim LinkInfo As String = Sl.Split(",").ToString
Dim NewLink As New ToolStripButton(LinkInfo(0))
ToolStrip1.Items.Add(NewLink)
NewLink.Tag = LinkInfo(1)'it gives the error here
AddHandler NewLink.Click, AddressOf GoToLink
Dim sep As New ToolStripSeparator
ToolStrip1.Items.Add(sep)
Next
End If
i不知道我做错了什么但加载时它给出了错误
ps
我的webbrowser中最喜欢的栏吧
i dont know what im doing wrong but when it loads it give the error
ps
its for a favorite bar in my webbrowser
推荐答案
您的一个字符串不包含'',''字符。因此,LinkInfo数组中只有一个条目,当您尝试访问第二个条目时,它会引发异常。
在引发错误的行上放置一个断点,并查看S1中的值。
One of your strings does not contain a '','' character. As a result, there is only one entry in the LinkInfo array, and when you try to access the second one it throws an exception.
Put a breakpoint on the line that throws the error, and look at the value in S1.
使用调试器:
1)设置为停止抛出异常(Debug - > Exceptions - > .Net Exceptions - >投掷[x])
2)在调试模式下运行程序
3)当调试器停止抛出execption的位置时,检查消息并检查个别变量
干杯
andi
Use the debugger:
1) set to stop on throwing exception (Debug --> Exceptions --> .Net Exceptions --> throwing [x])
2) run the program in debug mode
3) when the debugger stops where the execption is thrown, check the message and inspect the individual variables
Cheers
andi
这篇关于指数超出范围的例外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文