【问题标题】:How to add reference to Microsoft.VisualBasic.dll?如何添加对 Microsoft.VisualBasic.dll 的引用?
【发布时间】:2014-02-08 08:03:17
【问题描述】:
using Microsoft.VisualBasic;

Microsoft.VisualBasic.Interaction.InputBox("Favourite RPG?", "Game", "Cool!");

所以这基本上是询问用户他们最喜欢的 RPG。然后它显示默认值。我知道这是一个小例子,但我的程序无法运行,因为我收到了这个错误:

The type or namespace name 'Interaction' does not exist in the namespace 'Microsoft.VisualBasic' (are you missing an assembly reference?)

原来我发现了这个here

【问题讨论】:

    标签: c# inputbox


    【解决方案1】:

    除了using Microsoft.VisualBasic;,还要添加引用。这是一个直观的答案:

    然后

    【讨论】:

      【解决方案2】:

      您需要添加对Microsoft.VisualBasic.dll的引用

      您的 using 语句不是参考。它只是一个快捷方式,因此您不必每次想要访问其中的成员时都输入完整的命名空间。

      【讨论】:

      • 如何添加引用?我以前从未这样做过。
      • 右键单击您的项目文件,转到 add referenceadd 然后 reference 取决于您使用的 VS 版本
      • 好的,谢谢 :) 我会把这个给你,因为你是第一个。向其他提供帮助的人 +1 :)
      【解决方案3】:

      Solution Explorer 中右击你的References 点击Add Reference,然后搜索Microsoft.VisualBasic 并将其添加到您的参考文献中。

      有关更多信息,请参阅此文档:How to: Add or Remove References By Using the Add Reference Dialog Box

      【讨论】:

        猜你喜欢
        • 2012-04-07
        • 1970-01-01
        • 2020-01-19
        • 1970-01-01
        • 1970-01-01
        • 2015-08-28
        • 2021-02-27
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多