【发布时间】:2014-10-04 18:54:01
【问题描述】:
我正在尝试将一段代码从 VB 转换为 C#,但遇到了一行代码的问题。
VB 代码:
Dim tsAV As System.Windows.Forms.ToolStrip =
CType(objHost.FormMain.Controls("tsMain"), Windows.Forms.ToolStrip)
我在 C# 中的代码:
System.Windows.Forms.ToolStrip tsAV =
(System.Windows.Forms.ToolStrip)objHost.FormMain;
我的问题出在 FormMain 方法上。当我使用 VB 代码时,我可以获得 Controls 方法,但在 C# 中我不能。我使用包含两种方式的相同接口 DLL。
我做错了吗? DLL 是否可以包含某些仅在 VB 中有效的内容?
【问题讨论】:
-
什么是objHost?这个变量的类型是什么?
-
什么是
FormMain- 类或实例?