我在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.
有什么帮助吗?