C#代码转换成VB.net,事件注册处理方法
usingCTP;namespaceDemo{classProgram{staticvoidMain(string[]args){newtest().Run();}}cl...
using CTP;
namespace Demo{ class Program { static void Main(string[] args) { new test().Run(); } }
class test { MD api = null;
public void Run() { api = new CTPMDAdapter(); api.OnFrontConnected += new FrontConnected(OnFrontConnected);
try { api.Init(); api.Join(); // 阻塞直到关闭或者CTRL+C } catch (Exception e) { Console.WriteLine(e.Message); } finally { api.Release(); } }
void OnFrontConnected() { }
}}以上是c#代码,不会的地方为api.OnFrontConnected += new FrontConnected(OnFrontConnected);
我自己转换的代码为
Imports CTP
Module Module1 Public api As MD = Nothing
Sub Main() api = New MD ()//此处缺少代码 Try api.Init() api.Join() ' 阻塞直到关闭或者CTRL+C
Catch e As Exception Console.WriteLine(e.Message) Finally api.Release() End Try
End Sub
Public Sub OnFrontConnected() End Sub
End Module请高手帮忙 展开
namespace Demo{ class Program { static void Main(string[] args) { new test().Run(); } }
class test { MD api = null;
public void Run() { api = new CTPMDAdapter(); api.OnFrontConnected += new FrontConnected(OnFrontConnected);
try { api.Init(); api.Join(); // 阻塞直到关闭或者CTRL+C } catch (Exception e) { Console.WriteLine(e.Message); } finally { api.Release(); } }
void OnFrontConnected() { }
}}以上是c#代码,不会的地方为api.OnFrontConnected += new FrontConnected(OnFrontConnected);
我自己转换的代码为
Imports CTP
Module Module1 Public api As MD = Nothing
Sub Main() api = New MD ()//此处缺少代码 Try api.Init() api.Join() ' 阻塞直到关闭或者CTRL+C
Catch e As Exception Console.WriteLine(e.Message) Finally api.Release() End Try
End Sub
Public Sub OnFrontConnected() End Sub
End Module请高手帮忙 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询