I have looked at tutorials on jscript arrays, but not seeing it yet. I saw something similar asked but involving Win32 code not .NET.
Wondering, how do I pass arrays back and forth between JScript and a C# COM component?
For example, I have two properties defined in my C# COM that returns string and integer arrays as:
string[] HeaderLines { get; set; }
int[] ImagePixels { get; set; }
In my test.js file:
...
var T = new ActiveXObject("Imager.Reader");
...
var headerLines = T.HeaderLines;
WScript.StdOut.WriteLine("First HeaderLine:" + headerLines[0]);
var pixels = T.ImagePixels;
WScript.StdOut.WriteLine("First Pixel: " + pixels[0]);
The error is where headerLines[0] is written out: C:\temp\test.js(12, 1) Microsoft JScript runtime error: 'headerLines.0' is null or not an object
If I remove the headerLines in test.js, then I get this error (essentially the same but for the integer array): C:\temp\test.js(12, 1) Microsoft JScript runtime error: 'pixels.0' is null or not an object
I can get results from non-array properties just fine as well as passing values to other methods, but not with arrays. I also need to pass in string and integer arrays into a method defined in my C# COM component as:
bool Write(string filename, string[] headerLines, int[] pix, int width, int height);
I am using Visual Studio Express 2012 for Desktop for creating the COM piece in C#. If any other information is needed, just let me know.