I have the following ActiveX Executable written in VB6
' Sub GetPrices(WNum As Long, OpenPrices() As Single, HighPrices() As Single,
' LowPrices() As Single, ClosePrices() As Single, Volumes() As Long, Dates() As
' Long, NumberOfPricesToGet As Long)
' Fills provided arrays with stock history for the supplied WNumber and supplied number of days.
The following all works fine in VB
Dim t As Object
Dim Wnum As Integer
Dim o() As Single
Dim h() As Single
Dim l() As Single
Dim c() As Single
Dim Vol() As Integer
Dim Dates() As Integer
t = CreateObject("TC2000Dev.cTC2000"
Wnum = 1
t.GetPrices(Wnum, o, h, l, c, Vol, Dates, 100)
If I early bind in C# as follows - it also works OK (including intellisense) after adding the reference
TC2000Dev.cTC2000Class t = new TC2000Dev.cTC2000Class();
int days = 10;
int WNum = 2000;
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];
t.GetPrices(ref WNum, ref _open, ref _high, ref _low, ref _close, ref _vol, ref _date, ref Days);
However, how do I late bind it and make it work?
I have tried other functions that only return a single value and they work fine as follows
Type myType = Type.GetTypeFromProgID("TC2000Dev.cTC2000"
object myObject = Activator.CreateInstance(myType);
Int32 ans2 = (Int32) myType.InvokeMember("WordenNumFromSymbol",
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
myObject,
new object[]{"MSFT"});
But I cannot get the GetPrices that sends two parameters and returns six arrays to work
Also, is there anyway to so it without InvokeMember, such as Type.GetPrices ?
Thanks
JL
' Sub GetPrices(WNum As Long, OpenPrices() As Single, HighPrices() As Single,
' LowPrices() As Single, ClosePrices() As Single, Volumes() As Long, Dates() As
' Long, NumberOfPricesToGet As Long)
' Fills provided arrays with stock history for the supplied WNumber and supplied number of days.
The following all works fine in VB
Dim t As Object
Dim Wnum As Integer
Dim o() As Single
Dim h() As Single
Dim l() As Single
Dim c() As Single
Dim Vol() As Integer
Dim Dates() As Integer
t = CreateObject("TC2000Dev.cTC2000"
Wnum = 1
t.GetPrices(Wnum, o, h, l, c, Vol, Dates, 100)
If I early bind in C# as follows - it also works OK (including intellisense) after adding the reference
TC2000Dev.cTC2000Class t = new TC2000Dev.cTC2000Class();
int days = 10;
int WNum = 2000;
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];
t.GetPrices(ref WNum, ref _open, ref _high, ref _low, ref _close, ref _vol, ref _date, ref Days);
However, how do I late bind it and make it work?
I have tried other functions that only return a single value and they work fine as follows
Type myType = Type.GetTypeFromProgID("TC2000Dev.cTC2000"
object myObject = Activator.CreateInstance(myType);
Int32 ans2 = (Int32) myType.InvokeMember("WordenNumFromSymbol",
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
myObject,
new object[]{"MSFT"});
But I cannot get the GetPrices that sends two parameters and returns six arrays to work
Also, is there anyway to so it without InvokeMember, such as Type.GetPrices ?
Thanks
JL