0

![enter image description here][1]How do you use a messagebox to ask for user input using c#?

I tried the 'using Microsoft.Visualbasic;' and Microsoft.VisualBasic.Interaction.InputBox <--- the "Interaction" namespace doesn't exist.

Is there another way of asking a user for input or do I just create another form?

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

  • I think you can use it only to check which answer boxes have been press (like OK, Cancel, etc). However, in C# you can import the VB library and use inputBox if you want to actually get custom or build your own. Refer here... http://stackoverflow.com/questions/97097/what-is-the-c-sharp-version-of-vb-nets-inputdialog – Kairan Mar 14 '15 at 02:55

1 Answers1

0

You can use the input box by adding a reference to Microsoft.VisualBasic and then doing a :

Microsoft.VisualBasic.Interaction.InputBox("Hello");

However, most of the time this box is too limiting and you are better off writing a custom input form to allow you to get the input you desire.

John Koerner
  • 37,428
  • 8
  • 84
  • 134