using Microsoft.VisualBasic;
Microsoft.VisualBasic.Interaction.InputBox("Favourite RPG?", "Game", "Cool!");
Run Code Online (Sandbox Code Playgroud)
那么这样做基本上就是询问用户他们最喜欢的RPG.然后它显示默认值.我知道这是一个小例子,但我的程序不会运行,因为我收到此错误:
The type or namespace name 'Interaction' does not exist in the namespace 'Microsoft.VisualBasic' (are you missing an assembly reference?)
Run Code Online (Sandbox Code Playgroud)
最初我在这里发现了这个
Ken*_*eth 15
你需要添加一个引用 Microsoft.VisualBasic.dll
您拥有的使用声明不是参考.它只是一个快捷方式,因此您不必每次要访问其中的成员时都键入完整的命名空间.
右键单击您References的Solution Explorer点击Add Reference,然后搜索Microsoft.VisualBasic并将其添加到您的参考.
有关详细信息,请参阅此文档: 如何:使用"添加引用"对话框添加或删除引用