索引超出范围异常 [英] Index was out of bounds exception

查看:93
本文介绍了索引超出范围异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

专家,

我总是在行
的范围内超出索引范围

Experts,

I always get Index out of bounds exception at the line

arrSort(lCounter) = Trim(apiTable.RecNo) 



而可执行文件在循环下面...



while executig below loop...

Dim iOldPercent As Integer = 0
            Dim iPercent As Integer = 0
            ReDim arrSort(l)
            For lCounter As Integer = 1 To l
                If l <> 0 Then ''
                    iPercent = CShort(lCounter \ l * -100)
                End If
                If iOldPercent <> iPercent Then
                    ShowBar(iPercent)
                    iOldPercent = iPercent
                End If
                sText = apiTable.GetMemo("CONTACTS->COMMENT", 0)
                y = FtsAdd(ghFTSMemo, sText)
                If y < 0 Then
                    MsgBox("FtsAdd() failed at record " & Str(apiTable.RecNo()) & "Counter " & Str(lCounter))
                End If

                arrSort(lCounter) = Trim(apiTable.RecNo)
                apiTable.Skip(1)
            Next lCounter




任何答案将不胜感激.

预标签中的包装代码




Any answers will be highly appreciated.

Wrapped code in pre tags

推荐答案

arrSort(lCounter -1 )= Trim(apiTable.RecNo)应该可以解决此问题.不过,老实说,这个程序对我来说很困惑.
arrSort(lCounter -1 ) = Trim(apiTable.RecNo) should fix the problem. To be honest though, this program seems very confusing to me.


这篇关于索引超出范围异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆