I have a VB6 program which populates a two-dimensional array, passes that array into a function of a COM DLL, and then the COM DLL executes a VBScript assigning the array to a variable within the VBScript.
It sounds convoluted and antiquated, I agree, but my job is to fix the bug not re-write a lot of code.
In the VB6 program and in the VBScript the array variable is named "packageDetails". In VBScript and VB6 it is declared as:
dim packageDetails
In both VB6 and the VBScript I observe the following:
msgbox isArray(packageDetails) ' True
msgbox ubound(packageDetails, 1) ' 37
msgbox ubound(packageDetails, 2) ' 1
...this is as expected.
I have a CMS-generated TXT file with 10,000 records. I parse the TXT file with VB6. For each record I parse the data from the TXT file, populate array "packageDetails", then pass it to my DLL. 9,999 records work without error, but in ONE of the records I have the following issue:
In VB6 packageDetails(3, 0)
stores the string "EA", this is the expected value. But in VBScript on that same array when I do msgbox packageDetails(3, 0)
an exception is thrown with the description, "Type mismatch: 'packageDetails'".
The Event Viewer under Windows Logs/Application does not have any message for this issue.
Given that the max indices are 37 for the first dimension and 1 for the second, why does (3, 0) cause a type mismatch in VBScript but not in VB6 for the same array?
The array is populated by reading from a text file generated by the CMS operating system. I've observed the text file in a hex editor, and there are no unprintable characters in the file (no ASCII NUL bytes, etc).
Any thoughts on what might cause the issue?
packageDetails(3, 0)
, are you assigning it to some variable, printing it, etc? Would be useful if you show the whole statement, or more code. Best is to post an MCVE. – A.S.Hmsgbox packageDetails(3, 0)
in VBScript. In VB6 I'm just debugging and using a combination of the immediate window and the "Watches". – Developer Webs