Hello everybody!
I am trying to write a GUI for TWS in C#. IB supplies a nice little
VB -sample that I am studying (TWSAPI_VBSa).In this example there is a connection dialog where three values are entered:
The Ip address (as a string), a port number (as an int)and a clienti d(as an int).
I tried to copy this "concept" to C#, as follows:
imported a dll from vb,
created an object of the TwsClass called "Test";
TwsClass Test= new TwsClass();
Declared three variables to use in the parameter list:
int port = 7496;
int ClientId = 0;
string IPStr = "";
I called the method:
Test.connect(IPStr, port, ClientId);
...and got this error:
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at TWSLib.TwsClass.connect(String host, Int32 port, Int32 clientId)
Why can´t I do this?
If anybody has a clue please let me know.
Has anybody else succeded in communicating with the TWS api from C#?
TIA
Fredrik
I am trying to write a GUI for TWS in C#. IB supplies a nice little
VB -sample that I am studying (TWSAPI_VBSa).In this example there is a connection dialog where three values are entered:
The Ip address (as a string), a port number (as an int)and a clienti d(as an int).
I tried to copy this "concept" to C#, as follows:
imported a dll from vb,
created an object of the TwsClass called "Test";
TwsClass Test= new TwsClass();
Declared three variables to use in the parameter list:
int port = 7496;
int ClientId = 0;
string IPStr = "";
I called the method:
Test.connect(IPStr, port, ClientId);
...and got this error:
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at TWSLib.TwsClass.connect(String host, Int32 port, Int32 clientId)
Why can´t I do this?
If anybody has a clue please let me know.
Has anybody else succeded in communicating with the TWS api from C#?
TIA
Fredrik