“索引超出范围。必须是非负数且小于集合的大小。参数名称:index”

时间:2012-04-20 11:51:40

标签: vb.net exception

我正在运行VB.NET程序并且出现错误

“索引超出范围。必须是非负数且小于集合的大小。参数名称:索引”

我的代码如下所示。

  If Status.InvokeRequired Then
        Try
            Status.Invoke(New delegateoneArg(AddressOf onChangeEvent), ws)
            Catch ex As DivideByZeroException
            MessageBox.Show(ex.Message)

        End Try
    Else
        onChangeEvent(ws)
    End If

我有错误... Status.Invoke(New delegateoneArg(AddressOf onChangeEvent),ws)

2 个答案:

答案 0 :(得分:0)

检查状态对象的Invoke方法。这是访问超出范围值的索引。

答案 1 :(得分:0)

检查onChangeEvent处理程序的定义。您可能在那里访问过索引。 发布更多细节以获得稳健的答案。