小编use*_*783的帖子

UBound Array vb6转换为C#

我在VB6中有以下代码:

Dim frpdReport() As REPORTDEF

For iCounter = 0 To UBound(frpdReport)

    With frpdReport(iCounter)
        If .iReportID = iReportID Then
            fGetReportFile = .tReportFile
        End If
    End With
Next iCounter
Run Code Online (Sandbox Code Playgroud)

我转换为这个C#代码:

REPORTDEF[] frpdReport = new REPORTDEF[6];
 for (iCounter = 0; iCounter < Convert.ToInt32(frpdReport[6]); iCounter++)
    {
        if (frpdReport[iCounter].iReportID == iReportID)
        {
            fGetReportFile_return = frpdReport[iCounter].tReportFile;
        }

    }
    return fGetReportFile_return;
Run Code Online (Sandbox Code Playgroud)

调试时,我在for语句中得到以下错误 - "索引超出了数组的范围." 我无法弄清楚为什么因为数组的索引是6.

有什么帮助吗?

c# vb6 visual-studio-2010 vb6-migration

3
推荐指数
1
解决办法
2303
查看次数

标签 统计

c# ×1

vb6 ×1

vb6-migration ×1

visual-studio-2010 ×1