No one on any of the other boards seem to know
In VB.Net this late binding works fine
Dim Version As Integer
Dim Revision As Integer
Dim Wnum As Integer
Dim o As System.Array = System.Array.CreateInstance
(GetType(Single), 1)
Dim h As System.Array = System.Array.CreateInstance
(GetType(Single), 1)
Dim l As System.Array = System.Array.CreateInstance
(GetType(Single), 1)
Dim c As System.Array = System.Array.CreateInstance
(GetType(Single), 1)
Dim Vol As System.Array = System.Array.CreateInstance
(GetType(Int32), 1)
Dim Dates As System.Array = System.Array.CreateInstance
(GetType(Int32), 1)
t = CreateObject("TC2000Dev.cTC2000")
Wnum = 1000
Revision = t.GetRevision
Label1.Text() = Revision
t.GetPrices(Wnum, o, h, l, c, Vol, Dates, 100)
Label2.Text() = c(1)
When it is converted to C# late binding, the GetRevision
method works but the GetPrices does not
GetRevision only is suppose to return an Int32, but
GetPrices is supposed to return multiple System.Arrays
int WNum = 1000;
System.Array _open = new System.Single[1];
System.Array _high = new System.Single[1];
System.Array _low = new System.Single[1];
System.Array _close = new System.Single[1];
System.Array _vol = new System.Int32[1];
System.Array _date = new System.Int32[1];
object[] d = {WNum, _open, _high, _low, _close, _vol,
_date, day};
Type myType = Type.GetTypeFromProgID("TC2000Dev.cTC2000");
object myObject = Activator.CreateInstance(myType);
//Works
Int32 Revision = (Int32) myType.InvokeMember
("GetRevision",
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
myObject,
new object[]{});
label1.Text = Revision.ToString();
//Does not work
d = (object[]) myType.InvokeMember("GetPrices",
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
myObject,
new object[]{WNum, _open, _high, _low, _close, _vol,
_date, 100});
How does the InvokeMember need to change to allow the
GetPrices to work?
WNum and 100 are the input params, and _open, _high,
_low, _close, _vol, _date are system arrays that are
returned
Thanks
..