Calling .Net COM objects from VBScript

Posted by Majamer on Sun 22 Mar 2009 09:24 AM — 1 posts, 9,296 views.

#0
Hello,

I have a .Net class that I developed with C# and exposed to COM. One of the exposed properties is a two-dimensional array Measurements[,]. I can read this array with VB6:

Dim arMeasurements()

res = oCard.ReadMeasurements(arM, iFieldCount, iRowCount)

The oCard.Measurements property gets populated with a two dimensional array containing the records

ReDim arMeasurements(iRowCount, iFieldCount)
arMeasurements(iRows, iFields) = oCard.Measurements

I've tried to do the same with a VBScript:

res = oCard.ReadMeasurements(iFieldCount, iRowCount)
ReDim arMeasurements(iRowCount, iFieldCount)
arMeasurements(iRowCount, iFieldCount) = oCard.Measurements

For r = LBound(oCard.Measurements, 1) To UBound(oCard.Measurements, 1)
For f = LBound(oCard.Measurements, 2) To UBound(oCard.Measurements, 2)
s = s vbTab & arMeasurements(r, f)
Next
s = s + vbCrLf
Next
MsgBox s
but never worked. The script initalizes the object and forces it to read the measurements, and the proof that the data gets received is that the LBound and UBound of the array is correct, but s is empty. Any idea what I'm doing wrong?
Thanks,

Martha