Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add reference to Microsoft.VisualBasic.dll?

Tags:

c#

inputbox

using Microsoft.VisualBasic;

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

So what this does is basically ask the user their favourite RPG. Then it displays the default value. I know this is a small example but my program will not run because I'm getting this error:

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

Originally I found this here

like image 218
puretppc Avatar asked Jan 19 '14 01:01

puretppc


People also ask

How do you add references in Visual Basic?

To add references in Microsoft Visual Basic:On the Tools menu, click References. The References dialog box appears. Scroll through the list of components and make sure check marks appear next to the references you want to add.

How do I add a reference in solution explorer?

Add a reference In Solution Explorer, right-click on the References or Dependencies node and choose either Add Project Reference, Add Shared Project Reference, or Add COM Reference. (You can right-click the project node and select Add from the fly-out menu to choose from these options, too.)


2 Answers

In addition to using Microsoft.VisualBasic; add the reference, too. Here's a visual answer:

enter image description here

Then

enter image description here

like image 166
pcnThird Avatar answered Sep 28 '22 05:09

pcnThird


You need to add a reference to the Microsoft.VisualBasic.dll

The using statement you have is not a reference. It's merely a shortcut so you don't have to type the full namespace every time you want to access a member inside it.

like image 26
Kenneth Avatar answered Sep 28 '22 05:09

Kenneth